// Definition of code parameters
DEFPARAM CumulateOrders = False // Cumulating positions deactivated
// define parameters
dailyrange=Range[1]
longsma=Average[myaverage](close)
Dailyclose=DClose(1)
//Dailyopen=DOpen(1)
CloseTest=Dailyclose-dailyrange*.25
// Conditions to enter short positions
IF Dailyclose>= CloseTest and Dailyclose > longsma THEN
SELLSHORT 1 SHARES AT MARKET
ENDIF
// Conditions to exit long positions
// See Stops and target
// Stops and targets
SET STOP pLOSS loose
SET TARGET pPROFIT gain
Thanks for the post, but there is a major problem. The optimization tool does not include backtests made with internal bars check. It means that for this kind of daily strategy, the takeprofit is tested before the stoploss, that’s what we called here the “0 bar issue”.
In your optimizations results window, you can check the “Tick mode” column where the optimizer tells you how many orders are concerned with that problem, and there are a lot! So in order to get the best accuracy (and to validate the optimization), you’ll have to make backtests individually, with the tick-by-tick mode checked.
Nicolas
Thank you for your advice.
I will checked it out .
brgs
J-P