Multi time frame and trailing stop management

Forums ProRealTime English forum ProOrder support Multi time frame and trailing stop management

Viewing 15 posts - 16 through 30 (of 63 total)
  • #99664

    The conditions in line 53 will not be met again if price then drops below those conditions. You need a separate flag that you set to say they have been met and then only reset that flag when the position is closed. Without this the stop loss is moved but then price falls and the conditions for the stop loss are no longer true so it is not set again.

    #99666

    As I suggested in another topic on the italian forum, you’d better use another variable to keep track of TRADEPRICE, since this is a system constant, while you need a variable that, after PerCent2 is hit, changes its value to 50% of the gain, in order to start trailing normally fron that point.

    I suggested using MyTradePrice throughout the strategy, but the very first time the trade has been entered to initialize it, in which case your could initialize it with something like this:

    When PerCent2 is hit then assign it the new value you want to start from, which will presumably be MyTradePrice + 50% profit.

    Line 53 seems to be unnecessarily complicated!

    #99668
    I apologize but I did not understand your explanation. I do not have the sufficient capacity to understand what you have explained to me. My knowledge of the PRT code is very limited at the moment. What I can confirm is that I have analyzed dozens of operations and I noticed that the level of trailing stop, after being moved to 50% of the initial target, no longer follows the price trend. I tried to correctly apply the code created by Nicolas but otherwise there is still something I can’t understand. If you want to spend a few minutes helping me, I kindly ask you to write me the line of code to replace the one that doesn’t work now. I continue to try to find a solution. GRAZIE !!!
    #99669
    Hi Roberto, I well remember your suggestion about the “Mytradeprice” but I was hoping that by applying Nicolas’s code there would no longer be any need to use this type of instruction. Instead it seems to me that it is the only way to tell the system to move the level of trailing. Where should I put the three lines you sent me? After line 16? Unfortunately I’m losing a little with all these instructions and flags. I put the flag to not repeat the order if I go below the minimum of the pattern, I put the flag to re-propose the order even the following days if it is not immediately executed the day after … There is a lot of information that now I struggle to manage. I will try again to follow your advice but I will surely still need your precious help. GRAZIE.
    #99672

    Something like this perhaps (not tested):

     

    #99674

    I thank you very much for your kind help. I immediately try to change my code and check the results. Thank you again and I will certainly keep you informed on how this important change works. GRAZIE !!

    #99675

    I wrote this:

    But your SL & TP are so tight that it is impossible to have a breakeven, also in LIVE trading your orders would be rejected because they do not abide to minimun distance requirements!

    I also added a STEP value, but I never reached it.

    You should change the place of your SL.

    1 user thanked author for this post.
    #99676

    As I recommended before, use EXTENSIVELY  both Graph and GraphOnPrice or your’ll end up making mistakes on top of previous mistakes. And try to find one solution at a time!

    #99678

    This works, but I had to add a minimun TP and SL (line 34) to be able to trail it and I set Moltiplicatore=1 just before BUY:

    After launching it the first time you’ll see a couple of flat lines, due to BREAKEVEN being 0, far from the current price, so you’ll have to enlarge the scale pretty much when your first trade is entered.

    2 users thanked author for this post.
    #99715
    Hi everyone. I thank everyone for the kind answers you gave me. I am making some changes to my code to make it as similar as possible to what I will use in paper trading. Following Roberto’s suggestion that indicated that the value between breakeven and trailing was too small, I am changing some parameters. Initially the stop loss and take profit values ​​were equal and corresponded to the range of the setup candle. If the range of this candle had been of a few pips, there was the risk of not being able to understand well if the code worked or if it didn’t work for a programming error or because there were too few pips of difference. Now I will take the ATR value as a take profit and stop loss value with a multiplier to be able to manage the amplitude of the ATR and optimize the results. I have also noticed that the suggestion proposed by Roberto is very similar to the MFE and the trailing management in this way I think is very convenient and interesting. I think the only problem left is the trailing stop and I wanted to ask you a little clarification. After bringing the initial stop loss to breakeven (currently in my system this works without any problem) when I start the trailing stop I find myself having to manage two values: the number of pips that triggers the trailing stop and the number of pips from the which the trailing stop must start. I am still confused about this problem. I give an example to ask you for clarification. Suppose we have an ATR of 100 pips (100 pips below the trade price there is a stop loss and 100 pips above the trade price is my initial target). When my profit reaches 50 pips (ie half of my initial target) I automatically move the stop loss from -100 to zero (ie to my entry price). When then I reach 80 pips of gain I would like to move the stop loss from zero to +50 pips and at this moment to start the trailing stop (checking with the candles at 1 minute the “high” value reached to move the trailing without big delay) . Now I kindly ask you: is the value you call “trailing start” +80 or +50? If the trailing start is +80 (ie the number of gain pips from which trailing starts) how should I call the value +50 to make it work in the code? Honestly, I still can’t understand it. Can you please give me a practical example? In the coming days I hope to be able to show and share with you the new version of my almost final code. GRAZIE !!
    #99719

    Would you please format your text in a more suitable way? Thank you.

    #99720

    It’s difficult to read and easily understand when text is all in one paragraph 🙂

    #99721

    Sorry, I concentrated on explaining the problem and I didn’t give importance to readability. I try to format the text…

    I thank everyone for the kind answers you gave me.

    I am making some changes to my code to make it as similar as possible to what I will use in paper trading.

    Following Roberto’s suggestion that indicated that the value between breakeven and trailing was too small, I am changing some parameters.

    Initially the stop loss and take profit values ​​were equal and corresponded to the range of the setup candle. If the range of this candle had been of a few pips, there was the risk of not being able to understand well if the code worked or if it didn’t work for a programming error or because there were too few pips of difference.

    Now I will take the ATR value as a take profit and stop loss value with a multiplier to be able to manage the amplitude of the ATR and optimize the results.

    I have also noticed that the suggestion proposed by Roberto is very similar to the MFE and the trailing management in this way I think is very convenient and interesting.

    I think the only problem left is the trailing stop and I wanted to ask you a little clarification.

    After bringing the initial stop loss to breakeven (currently in my system this works without any problem) when I start the trailing stop I find myself having to manage two values: the number of pips that triggers the trailing stop and the number of pips from the which the trailing stop must start.

    I am still confused about this problem. I give an example to ask you for clarification.

    Suppose we have an ATR of 100 pips (100 pips below the trade price there is a stop loss and 100 pips above the trade price is my initial target).

    When my profit reaches 50 pips (ie half of my initial target) I automatically move the stop loss from -100 to zero (ie to my entry price). When then I reach 80 pips of gain I would like to move the stop loss from zero to +50 pips and at this moment to start the trailing stop (checking with the candles at 1 minute the “high” value reached to move the trailing without big delay) .

    Now I kindly ask you: is the value you call “trailing start” +80 or +50?

    If the trailing start is +80 (ie the number of gain pips from which trailing starts) how should I call the value +50 to make it work in the code? Honestly,

    I still can’t understand it. Can you please give me a practical example? In the coming days I hope to be able to show and share with you the new version of my almost final code.

    GRAZIE !!

    #99725

    In my code there is NO variable named TrailingStart, I simply use MyTradePrice to start from 80 as the basis to start trailing (at that point BreakEven = +50%). You can change tha value of MyStep to change the pace at which trailing stop works after hitting Percent2 (+80%).

    I changed a bit your code to get rid of comments and extra lines that made it less readable.

    If you add what you are missing or add new features, you’d better use my code, which is working fine (maybe removing the MAX() function and the line where MOLTIPLICATORE=1).

    You may still want to use the MFE code or whatever else, in that case you just have to reinvent the (working) wheel.

    I want to share a secret with you: “use EXTENSIVELY both Graph and GraphOnPrice!“. 🙂

     

    1 user thanked author for this post.
    #99749

    Hi Roberto and thanks for the suggestions.
    I’m using the Graph function more and more and actually it’s helping me a lot.
    Your help is always very useful, but unfortunately at the moment I don’t have the necessary experience to understand it well and insert it correctly in my codes.
    Sometimes I may appear to be insistent or boring, but believe me I just need only to get information that is not easy for me to understand now.
    The last code you gave me is undoubtedly very useful and I’ll start right from that to make the last changes to my code.
    As already mentioned above, with all the suggestions you gave me, everything is working well (entering the trade, repeating the order the day after, canceling the order if the conditions are no longer in place, etc.).
    Only the management of the trailing stop is yet to be settled.
    This weekend I will spend a lot of time correcting the code and adding your latest trailing tips.
    Thank you again very much for all the support you are giving me.
    I will surely keep you informed on the developments of my code

     

    1 user thanked author for this post.
Viewing 15 posts - 16 through 30 (of 63 total)

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