Stop Loss using very dynamic parabolic SAR

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #68155 quote
    LeoLeo
    Participant
    Veteran
    Hi all, i would like to share with you how I am using a stop loss with very good results. What is new about using a SAR as a stop loss? I use very low parameters, so at the beginning of the trade the levels are irrelevant but if the trade move significantly in my favour. It adapts its value to provide a very good resusts. I hope is as useful for you that it is for me so far. You need to define the initial stoplosslongn pips , initial stoplossshort in pips and the max pips to risk it calculates the ratio of actual gains compare with the initial stop loss, if it is more than 1 the parameter of SAR starts to increase rapidly  
    IF longonmarket THEN
    Kexit=max(1, ( (close-TRADEPRICE)/pipsize )/stoplosslong )
    Kexit= Kexit*Kexit
    ELSIF shortonmarket THEN
    Kexit=max(1, ( (TRADEPRICE-close)/pipsize)/ StopLossShort )
    Kexit= Kexit*Kexit
    ELSE
    Kexit=1
    ENDIF
    
    mySAR=SAR[0.001*Kexit,0.001*Kexit,0.7]
    
    // ---> exit long
    IF longonmarket then
    
    IF close crosses under MySAR and (close-TRADEPRICE)>0 THEN
    SELL AT MARKET
    ENDIF
    
    IF (close-TRADEPRICE) > 1*stoplosslong*pipsize THEN
    StopPoints=(TRADEPRICE-mySAR)/pipsize+spread
    StopPoints=max(0.5,StopPoints)
    SET STOP pLOSS min(StopPoints,maxrisk)
    ENDIF
    
    endif
    
    // ---> exit short
    IF shortonmarket then
    
    IF close crosses over MySAR and (TRADEPRICE-close)>0  THEN
    EXITSHORT AT MARKET
    ENDIF
    
    IF (TRADEPRICE-close) > 1*stoplossshort*pipsize THEN
    StopPoints=(mySAR-TRADEPRICE)/pipsize+spread
    StopPoints=max(0.5,StopPoints)
    SET STOP pLOSS min(StopPoints,maxrisk)
    ENDIF
    
    
    ENDIF
    GraHal, Nicolas and Rumjacks thanked this post
    #68339 quote
    GraHalGraHal
    Participant
    Legend
    @Leo thank you for this, I want to try it, but I can’t see where to define …

    initial stoplosslongn pips , initial stoplossshort in pips and the max pips 

    Do I need more coffee to wake me up?? 🙂 Thank You GraHal PS  I can see now … I need to add a few lines … but you may as well make it newbie proof for the benefit of others?? 🙂 🙂 Spread needs to be defined also. I’ll let you know the results … improvement already and it’s only 3% through optimisation!!! 🙂 🙂
    #68551 quote
    LeoLeo
    Participant
    Veteran
    Hi, nice that you like it, it is a comfort to help others. About the newbie prof is hard, because we need to explain many other things like spread:
    Spread=0.7 // eurusd for IG
    
    //SPREAD APROXIMATION
    IF TIME < 063000 THEN //(germany time)
    spread=1.7*spread
    ELSIF TIME>213000 THEN //(germany time)
    spread=1.7*spread
    ENDIF
    
    
    Stoplosslong initial is your style of trading, some use Dochian channel some other a fix value of pips, others the porcentage. I define max risk because a very bad experience (once I try ATR as stopploss and it traded  just after macroeconomics data release, which make me lost a lot! ) so whatever your stopploss is, do not exceed Maxrisk value. so, and the end coffee works? What about your trading with this stop loss system?
    #68583 quote
    NicolasNicolas
    Keymaster
    Legend
    Thank you Leo. I favorited your topic and I’ll test it once I have more free time 😐
    #68584 quote
    GraHalGraHal
    Participant
    Legend
    very strange … a reply of mine to this Topic (saying I had saved Leo’s Snippet to my database)  has disappeared??
    #68596 quote
    GraHalGraHal
    Participant
    Legend
    Oh well I am so glad my lost post was not a long one! So here it is again … I saved your snippet to my database Leo … Row 18. https://docs.google.com/spreadsheets/d/1rgboqj7sVwsP9ZRhOduOefye48QMWC07jWVXCl-KJPU/edit?usp=sharing Anybody can add / edit etc so feel free … the link is open to ALL. to add and benefit from the snippets.
    Leo and Nicolas thanked this post
    #68604 quote
    GraHalGraHal
    Participant
    Legend
    well confusing now eh!  … my post above was to another of Leo’s comments on another Thread / Topic 🙂 … but anyway check out the Snippet database – link in post above.
Viewing 7 posts - 1 through 7 (of 7 total)
  • You must be logged in to reply to this topic.
ProRealAI ProRealAI New

Stuck on this ProBuilder code?

Describe what this topic is trying to build, in plain English, and ProRealAI writes the ProRealTime™ indicator, screener or system for you.

Available in 7 languages
Try ProRealAI

Stop Loss using very dynamic parabolic SAR


ProOrder: Automated Strategies & Backtesting

New Reply
Author
author-avatar
Leo @leito Participant
Summary

This topic contains 6 replies,
has 3 voices, and was last updated by GraHalGraHal
8 years, 6 months ago.

Topic Details
Forum: ProOrder: Automated Strategies & Backtesting
Language: English
Started: 04/12/2018
Status: Active
Attachments: No files
ProRealCode ProRealCode
Loading...