Trade from Pivot-R-S points

Forums ProRealTime English forum ProOrder support Trade from Pivot-R-S points

Viewing 15 posts - 1 through 15 (of 17 total)
  • #63069

    Good Evening,

    i posted similar question on italian forum, we are working on it but still didn’t work correctly.

    Here what i would like to do, for backtest.

    Let’s consider for example Spot Eur/Usd, and TF weekly. As in the picture attached.

    I would like to set this code:

    At the begin of the week, it starts 2 pending orders, with related Stop Loss and Target Price.

    1st) Pending Long, from S1 with target Pivot, and SL on S2

    2nd) Pending Short, from R1, with target Pivot and SL on R2

    additional instructions:
    1) I would like to make sure that ONLY ONE order is executed per week, so that if the Long enters first, the Short one is cancelled, and same thing on the contrary.
    2) At the end of the period (in this case week), if the order entered is still active (therefore it has not reached either the stop loss or the target price), I would like it to be closed.

    In this case i considered wS1 – wS2 – wR1 -wR2 – wP, but i would like it works correctly even if i set dS1 – dS2 , so orders would be closed withing a day, and so on.

    Here i post a code that im trying to improve thanks to other users support, but still doesn’t work correctly.

    Thanks to anyone who can help 🙂

    #63074

    Do not duplicate topics in different languages, because this will spread info from different members over multiple topics making it difficult to keep track of them, thus making it less interesting.

    Choose a language with which you feel more at ease and stick to it, please. Thank you.

     

    #63081

    Sorry, i didn’t know. So, let’s keep it here, there could be more users interested/able to help us with it.

    Thanks

    #63144

    In pro builder zou do not have to define variables so you can take away all the definitions in the beginning since you don’t assign a value to the variables anyway. Just sayin’…

    #63156

    You don’t need the dummy lines at the end if instead of avoiding the error message, you correct the error, by using in line 34 the keywork “ignored” for each variable not used afterwards: (untested, but should work if I spotted the correct 3 variables used)

     

    #63158

    I’m going to try it! 🙂

     

    #63162

    Well, the result is profitable 😀  but not what I wanted to achieve,
    also corrected like this, it makes orders within the same week while I would like it to enter a maximum of 1 order only: if it intercepts wR1 first, it opens the short order, and cancels the pending long (with its stop and target). If, on the other hand, it first intercepts wS1, it should open the long order and cancel the pending short with its stop loss and target.
    We would thus have a maximum of one order per week.

    Limit case is when wS1 or wR1 are intercepted, it starts the order but then the price doesn’t reach TP or SL. In this case i would like it to close all the orders at the end of the week.

    Any idea how to proceed? 🙁

    #63163

    Just in case, even if I might be charged of stating the obvious, the line I suggested for line 34 is if only dR1 DR2 dS1 are used as per lines 36 through 40, having considered all the rest lines 44 through 49 as dummy. If you need to use more than just dR1 dR2 and dS1 from the “call”, the modification needs to be adapted by *not* replacing by “ignored” the relevant other variables used, and furthermore by picking them in the right order within the list of “ignored” (another source of frequent bug when using a “call” with a long list of returned variables most of them being ignored)

    #63168

    Thanks for your help,

    i feel so stupid, i can’t make it work 😀

    Let’s say i want to use onlw weekly pivot lines: so wP, wS1 wS2 wR1 and wR2. Same as in the pic attached.

    i modified the code like this:

    but it’s not working, it starts many order inside the same week. how would you change it?

    #63173

    Well, the result is profitable 😀 but not what I wanted to achieve, also corrected like this, it makes orders within the same week while I would like it to enter a maximum of 1 order only: if it intercepts wR1 first, it opens the short order, and cancels the pending long (with its stop and target). If, on the other hand, it first intercepts wS1, it should open the long order and cancel the pending short with its stop loss and target. We would thus have a maximum of one order per week. Limit case is when wS1 or wR1 are intercepted, it starts the order but then the price doesn’t reach TP or SL. In this case i would like it to close all the orders at the end of the week. Any idea how to proceed? 🙁

    All strategies are executed when each candle is closed, so on a 1-week chart all pending orders will be cancelled at the end of the week, NOT before! If a week is too much to wait you’ll have to switch to a lower TF, as of this version of PRT!

     

    #63174

    The way you call the indicator and the number of variables used won’t change the behaviour of your strategy, you may also delete lines 3-28, to make your strategy shorter, but it won’t affect the output.

    #63177

    Ok thanks, i understood about the fact it will delete pending orders at the end of the week. And it could be ok, but in this way i should only have max of 2 orders in a week (1 pending short and 1 pending long, eventually deleted at the end of the week), but actually the output is that i get more orders  in the same week, almost each 4h candele :/

    #63185

    Ok it’s working now, just the fact that it doesn’t consider the candle during it’s progress it gives me different results from my excel analysis. I hope they fix this :/

    #63186

    I just pasted your code but I can’t get any trade, on which instrument and TF are you testing this strategy?

    Also, I think lines 37-38 for LONGs and 42-43 for SHORTS shouldn’t have the same variable for the pending orders.

     

     

    #63188

    I backtested it on Eur Usd weekly!

Viewing 15 posts - 1 through 15 (of 17 total)

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