Dynamic StopLoss following an indicator

Dynamic StopLoss following an indicator

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.

 

Share this

Risk disclosure:

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 : How to import ITF files into ProRealTime platform?

PRC is also on YouTube, subscribe to our channel for exclusive content and tutorials

  1. gm74 • 04/28/2016 #

    This has changed my life. Thank you!!!!!

  2. gm74 • 04/28/2016 #

    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. 

  3. Madrosat • 04/28/2016 #

    Quelqu’un pourrait il répondre à cette question restée sans suite???

  4. denmar • 04/28/2016 #

    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

  5. denmar • 04/28/2016 #

    Testing email notification to Denmar

  6. David Black • 04/28/2016 #

    #gm74 Did you ever get this figured out?

    gm74

avatar
Register or

Likes

avatar avatar avatar avatar avatar avatar avatar avatar avatar avatar avatar avatar avatar
Related users ' posts
Doddge Hola Iván, ¿sería posible crear un screener que indique cuándo las velas coloreadas del indi...
RTR Ivan thank you for the pro-screener. I a trying to understand how to write the signals from ...
Iván Hi, Lines 62 and 63. These lines define buy and sell conditions.
Actaru5 Hi, I couldn't see the candles well. Changing the code solves the problem. from line 164 to...
LucasBest Thank you
Alai-n @LucasBest Hello, do you think it is possible to isolate moving averages? I would like to us...
mfejza also, for long trailing stop d2=low d1=lowest[3](d2)+1/3*AverageTrueRange[20](close) d3...
CederTrader Hi Denis, does this indicator add to the chart as panel, or on the candles. Thanks
Nicolas Add it on the price chart as described in this video: https://www.prorealcode.com/blog/video...
Denis Hello Nicolas and Ceder Trader, Sorry, I only just saw your replies. The indicator is alre...
Xenotrax A première vue, sa à l'air d'être un indicateur très puissant sur de petites temporalités, j...
merri Bonjour Nicolas, Comment transformer cet indicateur en bot sur PRT ?
Nicolas Cela a déjà été fait, voir ce sujet: https://www.prorealcode.com/topic/strategia-con-lindica...
zilliq Thanks @Nicolas. I tried to use it as Trend in a proorder system, but don't know why, it doe...
Suzu Yuk He is right. MT and mavgMT are not defined and causing errors.....
Zigo Zou je graag helpen, maar mijn computer is in onderhoud. Einde deze week, kan ik hopelijk te...
Zigo @ DimKar Midline = (stlong + stshort)/2 Return stLong coloured(0,255,0) as"StopLong", M...
DimKar Dear Zigo thank you very much for your answer !!!
Nicolas C'est dans ce sujet: https://www.prorealcode.com/topic/trendline-une-approche-du-trading/ M...
Pensera Bonjour Nicolas, comment est-il possible de backtester cet indicateur? cela fait une erreu...
Nicolas Oui bien sûr, il doit y avoir pas mal de sujets dans le forum à ce propos.
Nicolas remplacer les valeurs de coloured(0,255,0) par coloured(r,g,b) et ajouter ces noms de variab...
mohamed merci Nicolas!
sacram14 Merci Nicolas pour ce set-up que je ne connaissais pas ! J'ai tenté de reprendre le code pou...
Nicolas Pour créer des alertes, vous pouvez suivre ce petit tutoriel : https://www.prorealtime.com/f...
thibault76 Bonjour Nicolas, cette stratégie est intéressante. Par contre, en 2022, le code ne fonction...
Nicolas Aucun message d'erreur pour ma part en version 11.1. Tu es certain de créer un code d'indica...
Jan Wind Thanks for sharing ! The Gain/Loss ratio is a bit low, 1,16, hardly offset the risks take...
drive whats the period ?
Lucas0000 Hola. estoy buscando un programador en proorder, para hacer un programa basado en el Q-trend...
Nicolas Just add it on the price series.
yomisadiku Hello Nicolas, Can I use high and low price at lines hh=max(hh,close) and ll=min(ll,close) ...
Nicolas Yes you can do that, the impact will be that the trailing stop line will be much close to th...
rama what is the buy condition or sell condition for this can you suggest a code k1=1 buy and k1...
rama I would like to know at point 1 an alert or binary indicator so that I can place order
maxlys Bonjour Nicolas, merci pour ce code qui a l'air intéressant. Comment ajouter dans le code l'...
nfulcher Please could someone explain how the following code is calculated:- iDI = TEMA[3](DI[DI2]...
oakenstream Jan, I find sometimes that the priceexit variable is never set. It seems to happen when the ...
Matt66612 I do not understand the first time I launch the backtest I got the same result as you. but ...
Marcel The line is just a moving average line. The indicator reacts on the Parabolic SAR dots.
Mattzi I dont get the dots! What am i doing wrong? :)
Mattzi Ignore this comment ;)
joobeng Sorry, I solved the problem. I have add the CBL indicator using the spanner icon on the pric...
Nicolas Adjust the price settings for the Y Axis to use the price only.
XXXXVII Hello Your indicator is interesting. However, I can't see the orange line. Do you have ...
bharatjai Script 'Adaptive ATR' has been saved line 24: no viable alternative at input 'lr' Gettin...
Nicolas download the itf file and import it into your platform.
Francis3332 Bonjour à tous, J'aime beaucoup cet indicateur et j'aimerais pouvoir l'utiliser sur la dern...
Nicolas Definition of CustomClose: https://www.prorealcode.com/documentation/customclose/ [2] means...
Bard Just wondered Nicolas, say you had set DEFPARAM CumulateOrders = True, is there anyway for t...
Bard Sorry pls ignore last image, try this - it actually has the Dev Stop indicator! https://www...
juanj C = Count
Bard Thanks for the explanation. I couldn't get it to load anyway.
Khaled Hello everyone, I'm coming late into this discussion... Brad cannot load the code because th...

Top