Forums › ProRealTime English forum › ProOrder support › Why are these stoplosses not removed? › Reply To: Why are these stoplosses not removed?
The code will only set the order for the last SET STOP instruction that is read. Usually people have it at the end of the code for this reason.
If that’s the case, I have changed my code to the following:
|
1 2 3 4 5 6 7 8 9 10 11 12 13 |
sl = 0 SET STOP pLOSS 0 IF (c20) THEN SET STOP pLOSS SuperTrendIndicator sl = 1 GRAPHONPRICE SuperTrendIndicator as "StopLoss set to ST" ENDIF IF ((NOT c20) AND (c1 AND (PSARIndicator > SuperTrendIndicator))) THEN SET STOP pLOSS PSARIndicator sl = 2 GRAPHONPRICE PSARIndicator as "StopLoss set to PSAR" ENDIF GRAPH sl as "Stop Loss" |
and it still doesn’t make a difference.
The last line ‘read’ could be one of the stoploss lines in the “IF” statements. By their very construct, only 1 can be true. If neither are true, then the last line read should be the one before the “IF” statements, correct?
If not, then how is it possible to set dynamic STOP LOSS values based on various calculations?
I assume your supertendindicator and psarindicator values are calculated as a distance in pips rather than as a price?
Those values are the actual value of the PSAR or SuperTrend. For example:
|
1 |
PSARIndicator = SAR[0.02,0.02,0.2] |
Is that the correct way to go about it?
Thank you.