hi there,
i want to back test a strategy bassed on heikin-ashi. i have the conditions for entry the market and i want to exit the very next day after the entry point no matter what (or even the second day after the entry point).
how should i code this? (i dont know what follows the if command for sell at market)
thank you.
// Definition of code parameters
DEFPARAM CumulateOrders = False // Cumulating positions deactivated
//special calculation of H.A.
once xOpen = open
xClose = (open + close + high + low) / 4
if barindex > 0 then
xOpen = (xOpen + xClose[1]) / 2
endif
c1 = xOpen < xclose //now H.A. bullish
c2 = xOpen[1] >= xclose[1] //H.A.[1] bearish
// Conditions to enter long positions
IF c1 and c2 THEN
BUY 1 SHARES AT MARKET
ENDIF
// Conditions to exit long positions
IF THEN
SELL AT MARKET
ENDIF
The second day AFTER the entry points is a day later than the VERY NEXT day from to entry.
If you move lines 21-25 to line 10 you will be able to exit the very next day from entry.
gnellas77 – Your topic has been moved to the correct forum which is the ProOrder forum for strategy subjects. Please be more careful with future topics to ensure that they are posted in the correct place.
_ ProRealTime Platform Support: only platform related issues.
_ ProOrder: only strategy topics.
_ ProBuilder: only indicator topics.
_ ProScreener: only screener topics
_ General Discussion: any other topics.
_ Welcome New Members: for new forum members to introduce themselves.