Please, I need help with code

I would like to be helped please, I can not program the conditions detailed below and this would help me to know how to do it in my future systems.

The conditions are:

Set up:
cond1 = High < Ref(High,-1); today's high less than yesterday's high.
cond2 = Low > Ref(Low,-1); today's low greater than yesterday's low.

  1. If yesterday's conditions were met, today we place a buy stop order equal to yesterday's high. If the opening has been with a gap, then we buy at today's opening price.

  2. We close positions when we get a 5% profit or at the first opening higher than the buy price.

I have been searching for hours on the web and I can't get it programmed...

Try searching this forum for the phrase "limit order". To use limit or buy stop orders correctly with a large universe of symbols and full use of your capital, you need to use a Custom Backtest (CBT). To use those types of conditional entries assuming the use of some account leverage, which is not always in use, you can use StaticVarGenerateRanks. Both of these subjects are covered in other posts.

This topic was automatically closed 100 days after the last reply. New replies are no longer allowed.