I think I’ve found it. I used the GRAPH Function to find the negative value.
I’ll pop it back Live and let you know if it goes okay.
Profit over 100,00 bars is the same with my changes below.
(I’m getting worried now … I might make a coder after all!? 🙂
Naah … I’m just not too bad at fixing things in general).
This line
47 FS = (CLOSE-OPEN) <= - RS*POINTSIZE
should read
47 FS = (OPEN-CLOSE) >= RS*POINTSIZE
Got the Same error as GraHal on 60 min version.
I have done the change and put it back live. See what happens.
HAHAHAHA … ‘Pride goeth before a fall’ … good job I’m among friends … got rejected again for same zero offset error.
Back to the Drawing Board!
I think this might be the issue as these variables need to be set outside the if statement as DC will not be set.
IF LONGONMARKET THEN
DC=20// period of Donchian Stop
TGL=5//Trailing Stop pip distance
TP=30//take profit
//SL=50// stop loss
ELSIF SHORTONMARKET THEN
DC=20
TGS=5
TP=30
//SL=50
ENDIF
this code will fail as dc is only set if you long or short
e= Highest[DC](high)
f=Lowest[DC](low)
Updated the code like this. Just assigned a default value to the variables. can be overwritten if long or short.
DEFPARAM CumulateOrders = false
//LONG VARIABLES
DC=20// period of Donchian Stop
TGL=5//Trailing Stop pip distance
TGS=5
TP=30
IF LONGONMARKET THEN
DC=20// period of Donchian Stop
TGL=5//Trailing Stop pip distance
TP=30//take profit
//SL=50// stop loss
ELSIF SHORTONMARKET THEN
DC=20// period of Donchian Stop
TGS=5
TP=30
//SL=50
ENDIF
Ah Gotcha!
Thanks Stanton, I made your changes and popped it back in Live … I let you know how it goes, should know by 15.30 UST+1 as mine is the 30 min version!
Almost feels like fun now with the speedy iterative fixes! 🙂
GraHal
Yep that’s it all good now, no rejection! Good work!
Poor show that Backtest doesn’t show up ‘zero / negative offset errors’!?
ALEModerator
Master
Hello
Sorry guys but I posted the codes too fast and I missed the errors, it is a refused, in the evening I will update the files.
Sorry Grahal but I did not understand what you say .
Thanks and Sorry!
All good Ale.
Thanks for a great strategy.
Running it live with a small account will let you know how it goes.
ALEModerator
Master
HELLO,
DO YOU THINK THAT IS CORRECT ?:
DEFPARAM CumulateOrders = false
//VARIABLES
DC=DC// period of Donchian Stop
TGL=TGL//Trailing Stop pip distance
TGS=TGS
TP=TP
//SL=SL
IF LONGONMARKET THEN
DC=20// period of Donchian Stop
TGL=5//Trailing Stop pip distance
TP=30//take profit
//SL=SL// stop loss
ELSIF SHORTONMARKET THEN
DC=20// period of Donchian Stop
TGS=5
TP=30
//SL=SL
ENDIF
Dont think that will work as DC will only be given a value if you are on the Market.
This code gets run if you on the market or not.
e= Highest[DC](high)
f=Lowest[DC](low)
At that point DC = null
Which will give an error
You could also do this.
DEFPARAM CumulateOrders = false
//VARIABLES
IF LONGONMARKET THEN
DC=20// period of Donchian Stop
TGL=5//Trailing Stop pip distance
TP=30//take profit
//SL=SL// stop loss
ELSIF SHORTONMARKET THEN
DC=20// period of Donchian Stop
TGS=5
TP=30
//SL=SL
ENDIF
if longonmarket then
f=Lowest[DC](low)
laststop = f[1]
endif
if shortonmarket then
e= Highest[DC](high)
laststop = e[1]
endif
if onmarket then
sell at laststop stop
exitshort at laststop stop
endif
Hi Ale
No problem, no Sorry 🙂
Stanton first fix here #34278 works as I’ve had no rejections since Time 15:30 today.
GraHal
ALEModerator
Master
Thanks Grahal 😛
So.. which code we fixed in the main code? Now I’m confused… it would have been better if I had maintained my disorder 🙂 before to change code, the other day ..