hi! I am having difficulties to implement an index based strategy and need help. It’s not about the pattern, but about the conditional entry that I need help.
Setup of the pattern could be like
- take any condition to be true for the pattern today, e.g. high-low > 5
- when the pattern is true today, enter long tomorrow (and only tomorrow), but only when tomorrow’s high is higher than today’s high.
The condition under 2) is like a stop-entry.
Would be thankful if any of you could guide me with a very short code structure given the info above. Thank you.
There you go:
PatternToday = range > 5*PipSize //range = high - low
IF high > high[1] AND PatternToday[1] AND Not OnMarket THEN
BUY 1 CONTRACT AT MARKET
ENDIF
Dear Roberto,
thank you for your reply. It worked well and I would like to enhance it.
What do you need to add to:
- trigger a buy only if the pattern happened in the last 3 bars
- as the entry condition, take the high on the day when the pattern happened (which can be any of the 3 days)
thank you ahead.
There you go:
PatternToday = range > 5*PipSize //range = high - low
IF PatternToday THEN
EntryPrice = HIGH
ENDIF
IF high > EntryPrice AND Summation[3](PatternToday) AND Not OnMarket THEN
BUY 1 CONTRACT AT MARKET
ENDIF