stopLoss on highest [2] high issue

Forums ProRealTime English forum ProOrder support stopLoss on highest [2] high issue

Viewing 12 posts - 1 through 12 (of 12 total)
  • #189321

    Hi there, I am having an issue and don’t know how to move forward with this, I want for the code to set my stop loss when long in the lowest of the past 2 candles and when shorting the market on the highest of the last 2 candles.

    I am using function Highest but not getting the expected results, also the TP is not corresponding with the instructions I am giving. I am really new to programing though! my code is:

     

    thank you so much in advance 🙂

     

     

    #189323

    Substitute figures in your code below and I think you will see 2 reasons it’s not working?

    st1= lowest[2](low)
    tp1= st1*2
    So on DJI if lowest[2](low) is, for example, 35,000 so you be exiting at 35000 points loss or 70,000 points profit at lines 27 and 28.

     

    1 user thanked author for this post.
    #189324

    Is it because I am only entreing the value of the market and not the points value right? I have tried from different angles one of them beeing this

    st2= (highest[2](high)-open[0])

    but results don’t differ, in my mind that would subtract those hypothetical 35,000 from the opening of the current candle (candle that the trade is open) so I could get the number of points that its needed but the results are the same, I did try to look into many codes now to see if anyone would use this kind of stop but didn’t found one so far or found many, way more complex to my knowledge..

    is there any book on the Pro Realt Time code or so? besides the courses?

     

     

    #189325

    Is it because I am only entreing the value of the market and not the points value right? I have tried from different angles one of them beeing this

    st2= (highest[2](high)-open[0])

    or

    st2= (highest[2](high)-close[1])

    but results don’t differ, in my mind that would subtract those hypothetical 35,000 from the opening of the current candle (candle that the trade is open) so I could get the number of points that its needed but the results are the same, I did try to look into many codes now to see if anyone would use this kind of stop but didn’t found one so far or found many, way more complex to my knowledge..

    is there any book on the Pro Realt Time code or so? besides the courses and besides the manual PRT gives us

    Want to learn more about it but have barely any base in coding

    also didn’t know how to edit the post or to delete the other one

     

     

    #189326

    Is it because I am only entreing the value of the market and not the points value right?

    Yes

    If you wanted to use the value of the market, you would need to use something like below …

    I say something like as I started with barely any base in coding also 6 years ago and even now I rely on the syntax checker in the code editor to put me straight.

    If you use …

    GRAPH ST1
    GRAPH TP1

    then you will see the values as a separate area under the positions after backtest.  

     

    These may help you, but they have not been updated to current version 11, but nonetheless are very useful?

    https://www.prorealtime.com/en/pdf/probacktest.pdf

    https://www.prorealtime.com/en/help-manual/quick-tour

    PS

    We get 5 mins to edit a post after posting

    Or you could do …

    If Longonmarket Then
    SEll at st1 Stop
    SEll at tp1 Limit
    ENDIF

     

    1 user thanked author for this post.
    #189327

    yeah I get it this is quite hard but it’s a really interesting tool to make us not lose so much time in backtesting stuff, especially the part where we can add variables and it automatically finds the best one.

    I am really sorry But I was looking at another thing: I was looking to set the stop (while shorting the market) at the highest point of the last 2 candles and vice versa, not the high of the market.

    I hope you have been getting good results with it! it’s already been a long time in coding, hope to trace a similar path.

    I have read that on another post about the 5 minutes to edit still don’t find where to

     

    thank you so much for you time

     

    PS: I got it now the Edit part!

    #189331

    SET STOP pLOSS (and SET TARGET pPROFIT, as well), need a difference in price exèpressed as pips, NOT a price, otherwise, as suggested by GraHal, it will NEVER be hit and, in live trading, your strategy will be stopped due to a too far stop loss.

    SET STOP pLOSS and SET TARGET pPROFIT should only be set ONCE per trade. To change the SL while on market you should use a pending order.

    1 user thanked author for this post.
    #189332

    Hi Roberto, first of all thank you so much for THE great works and strategies that you have shared!

    “need a difference in price exèpressed as pips, NOT a price”

    yeah, I am getting that now but still can’t figure out how to make it, and perhaps I am also expressing myself the wrong way..

    the objective is every single time it triggers a buy order long – the code should calculate what is the amount of pips between the opening of the candle that trade opened (or the close from the candle before trade opens) and the lowest pricepoint in the 2 last candles – in other words, I want to open a position and define my stop loss at the lowest point of the wave we are in. That will change in a trade by trade basis.

     

    thats is why I thought:

    lowest [2] (low) – (open[0])

    or

    lowest [2] (low) – (close[1])  //meaning the lowest of the two last candles (price) minus the opening of the entry candle or the close of the candle before opening trade would give me an amount of pips for the stoploss

    #189337

    SET STOP pLOSS (or LOSS) is not a trailing STOP, su using SET STOP LOSS ABS(lowest [2] (low) – (open[0])) or SET STOP pLOSS ABS(lowest [2] (low) – (open[0])) / PipSize won’t follow the price as it rises (if you opened a LONG trade), but will always modify your original distance from the Entry Price. It actually could become bigger, in case of some huge bars!
    Use a STOP pending order:

    #189343

    oh man thank you so much for the amazing effort and I am understanding further the issue  “”but will always modify your original distance from the Entry Price””. Especially this part since in reality, I don’t want a trailing stop loss, rather a fixed one but at the same time, I don’t want it to increase.

    I have attached an example of what I would love to get as a result. In layman terms is just a simple entry with a fixed stop on the highest point of the two candles before the opening, and a Take profit of double that amount of pips, it either goes one way or the other without moving anything, nor the stopL neither the TP.

    This is such a journey to even get one simple thing done, but such an interesting thing because on the other hand spares us months of manual work.

    once again thank you so much for you time and sorry if miss explain myself

    #189348

    There you go:

    1 user thanked author for this post.
    #189349

    thank you so much!! you just made my day!

    and thank you once again for the time and dedication for both of you

     

    cheers

     

    2 users thanked author for this post.
Viewing 12 posts - 1 through 12 (of 12 total)

Create your free account now and post your request to benefit from the help of the community
Register or Login