I have the below code below that simply sets a stop based on the ATR when either in a long or short position. I have been forward testing on MY IG demo account since back testing does not give reliable results.
The strategy works on a daily time frame on the South African TOP 40 index. The thing I find very strange is that it does not set the stop on the first trade, only on the second trade does it set the stop, Why is this?
Am I the only person to experiencing this or is this peculiar to prorealtime?
You can try to make a new variable named “stoploss” for instance, and give it the value of your calculated SL points (make it different when you initiate your orders BUY and SELLSHORT).
Then, later in the code, add the SET stop loss line as is:
Ok . So if I understand correctly I will set the variable in the buy or sellshort instruction and later in the code use the stop loss command using the variable originally set in the buy or sellshort command.
To help us continually offer you the best experience on ProRealCode, we use cookies. By clicking on "Continue" you are agreeing to our use of them. You can also check our "privacy policy" page for more information.Continue