Hi everybody!
In this example we are following a position with Parabolic SAR indicator.
Each new candle will be updating STOPLOSS to the new Parabolic SAR position.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
REM INDICATOR mySAR = SAR[0.02,0.02,0.2] REM CONDITIONS c1 = mySAR >= High c2 = mySAR <= Low IF Not OnMarket THEN IF c1 THEN BUY 1 CONTRACT AT mySAR STOP ENDIF IF c2 THEN SELLSHORT 1 CONTRACT AT mySAR STOP ENDIF ENDIF IF LongOnMarket THEN mySTOP = mySAR IF Close >= TradePrice(1) THEN mySTOP = mySAR SELL AT mySTOP STOP ELSE SELL AT mySTOP STOP ENDIF ENDIF IF ShortOnMarket THEN mySTOP = mySAR IF Close <= TradePrice(1) THEN mySTOP = mySAR EXITSHORT AT mySTOP STOP ELSE EXITSHORT AT mySTOP STOP ENDIF ENDIF |
Share this
No information on this site is investment advice or a solicitation to buy or sell any financial instrument. Past performance is not indicative of future results. Trading may expose you to risk of loss greater than your deposits and is only suitable for experienced investors who have sufficient financial means to bear such risk.
ProRealTime ITF files and other attachments :
Filename : download the ITF files
How to import ITF files into ProRealTime platform?
PRC is also on YouTube, subscribe to our channel for exclusive content and tutorials
This has changed my life. Thank you!!!!!
I might have spoken too soon. Could you possibly shed some light? I am wanting to set dynamic stop losses based on my profit. In effect a highly customisable trailing stop.Take the following for example. if the trade is 250 points in profit, I would like to set a stop loss at 100 points profit. Look at the following example for if I were in a short trade:
//Current trade points in profit profits=positionperf*tradeprice
if shortonmarket then
if profits>250 then
exitshort at tradeprice-100 stop
endifif profits>400 thenexitshort at tradeprice-350endifendif
However, this does not give me the desired result. Do I also have to open the short in the same way? As I am currently opening the short as follows:
sellshort at market
I do not wish to use trailing stops, as I want the freedom to adjust the stop trailing steps at various intervals. Ie, if 250 points in profit, exit if drop to 100 BUT if 400 points in profit, exit if drop to 350.
Any help would be appreciated.
Quelqu’un pourrait il répondre à cette question restée sans suite???
Hi
Could somebody please enlighten me how this code operates. I wish to use the code (is this an indicator?) as a mechanism to automatically adjust my stop once in a trade. Can one invoke this once one has opened a position manually? If so, how is this done. Is it simply a matter of attaching the “indicator” [My experience is limited to Metatrader where there was a difference between indicator and things called scripts] This being the case could I split the code and have one for long – including lines 19 -27 and one for short – including lines 29-37.
Thank you
Testing email notification to Denmar
#gm74 Did you ever get this figured out?
gm74