Orders Rejected due to incorrect SL an TP

Forums ProRealTime English forum ProOrder support Orders Rejected due to incorrect SL an TP

Viewing 8 posts - 1 through 8 (of 8 total)
  • #191912

    Good evening everyone,

    I am struggling to get my code to open new orders. I have a simple entry rule and a set stop loss and set take profit. I am trying to update the code so that as it approaches the Stop Loss, it enters more trades (Up to 3 additional trades) – all with the same stop loss and take profit as the original trade.

    The problem I am getting now is that all my orders are rejected as stop loss tries to enter with price 16,000 and Take Profit 115,000 while the index price is around 66,000. I have tried every combination of PipSize/p/$ and can’t get it to work. In reality take profit and stop loss should only be a few hundred points away from the index price, not tens of thousands!

    If anyone could point out where I am going wrong, I would greatly appreciate it!

    Kind regards,

    Anton

     

    #191931

    You are multiplying with PIPSIZE your stoploss/takeprofit calculation, I don’t understand why? Because you already get a price value and use it with SET TARGET PROFIT and SET STOP LOSS which are both using a price distance value.

    1 user thanked author for this post.
    #191933

    Thank you Nicolas, I’ve updated and they are still giving the same issue. So below, I changed Take Profit to a set amount  (TPT) and Stop loss to (SSS) instead of the variables TPT2 and SSS2.

    All orders now seem to use the original Stop Loss level. But the take profits are still all different. I’ve attached a picture as an example. It shows an original Long Trade then as the price dropped it entered another Long. Both have the same Stop loss but different Take profits.

    Both Take profits should be where the top one is (the original level)

     

    #191939

    Try using TradePrice(1), instead of TradePrice[1].

    1 user thanked author for this post.
    #191969

    Always GRAPH your variables while debugging, it will save you precious time.

    #191978

    Thank you Nicolas, please forgive my ignorance. Could you please explain me how to graph when debugging?

    #191980
    JS

    Hi @15482847

    Just simply add “Graph” at the end of your code… (and BackTest)

    This will show you the “Graph” variables in your graph…

     

     

    1 user thanked author for this post.
    #191982

    This is amazing, thank you JS. I will definitely be using this going forward!

    1 user thanked author for this post.
    avatar JS
Viewing 8 posts - 1 through 8 (of 8 total)

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