Hello Guys,
hope you can help me ... there must be a failure in my code.
I just wanted to exit a long position after a random entry criteria either at a stop loss level at 2% from entry or if this stop never get triggered after 3 days in market (sell at close) time based exit.
every time when i try to run the strategy following error appears "Runtime error: Der Objektverweis wurde nicht auf eine Objektinstanz festgelegt. bei WealthLab.Strategies.MyStrategy.Execute()
and also only 2 trades were done in 15 years backtest. !?
i will attach my coding.... hope you can help me.
CODE:
Please log in to see this code.
Size:
Color:
CODE:
Please log in to see this code.
Size:
Color:
P.S. A couple of notes:
#1 - The stop and limit orders were peeking into the future (corrected).
#2 - You might want to check out the WealthScript Programming Guide, Programming Trading Strategies > Peeking > Order of Trading Signals.
Size:
Color:
Hi Eugene,
thanks for quick info... i will check that programming guide... only one thing left...
what if i want the same also on short side ....
so both on long and short side , stop loss 2% or time based exit either what triggers before ?
thanks so much
Size:
Color:
Hi Thomas,
Then I guess it would be like this:
CODE:
Please log in to see this code.
QUOTE:
so both on long and short side , stop loss 2% or time based exit either what triggers before ?
Time-based exit - being a marketable/AtClose order - would trigger before AtStop.
Size:
Color: