Strategy GBPJPY 1H

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #245470 quote
    Schizophunk
    Participant
    New

    Hi,

    I am working on this robot to operate GBPJPY spot in 1H timeframe.

    I found that the TP and SL dont get shoot when they should.

    Also I would like to ask you guys which is the best asset to operate this spot (CFD, Futures,..) (Share the Ticker, if any).

    // Parametros
    DEFPARAM CumulateOrders = False
    //DEFPARAM FLATBEFORE = 031500
    
    // Calculo PP, R1, y R2
    pivot = (DHigh(1) + DLow(1) + DClose(1)) / 3
    ppr1 = pivot *2 - DLow(1)
    ppr2 = pivot + (DHigh(1) - DLow(1))
    
    //Representacion de PP, R1, y R2
    ONCE pivot = pivot
    ONCE ppr1 = ppr1
    ONCE ppr2 = ppr2
    GRAPHONPRICE pivot COLOURED (255,255,255,150) AS "Pivot Point"
    GRAPHONPRICE ppr1 COLOURED (255,0,0,150) AS "R1"
    GRAPHONPRICE ppr2 COLOURED (255,0,0,150) AS "R2"
    
    // CONDICIÓN DE ENTRADA
    ONCE InitialCapital = 10000
    IF NOT ONMARKET AND Close >ppr2 THEN
    SL = lowest[6](Low[1])
    GRAPHONPRICE SL COLOURED (0,0,255) AS "SL"
    distanciaSL = abs( Close - SL )
    TP = Close + (3 * distanciaSL)
    GRAPHONPRICE TP COLOURED (0,0,255) AS "TP"
    X= (InitialCapital/1000)
    BUY X LOTS AT MARKET
    ENDIF
    
    IF ONMARKET THEN
    SET STOP LOSS SL
    SET TARGET PROFIT TP
    ENDIF

    Thank you all,

    #245473 quote
    druby
    Participant
    New

    When you calculate the SL and TP, they are price levels, not an amount of points from the entry price.

    Change to…

    SET STOP price SL
    SET TARGET price TP

    Also, place them in the entry IF block so they stay at the same level when the entry is made.

    The entry block won’t be executed till it’s not on market again.

     

    I’m not sure if this is exactly why but, when the BUY code is executed, its not deemed ONMARKET till the order has been executed on the open of the next bar.

    I think the new STOP/TARGET are not set till after the entry.

    If a prior set STOP/TARGET levels ends up on the wrong side of the new BUY order level, it will trigger that STOP before it can set the new STOP/TARGET.

    This appears as a entry and exit at the same price. ( when STOP/TARGET orders are in the ONMARKET BLOCK )

    This is why I think the new STOP/TARGET are not set till after the entry, because trade  exits before they can be set.

     

    You have to realise that the prior set STOP/TARGET is the last valid trade that executed right, and the calculated STOP/TARGET levels are now different.

    This is because they were calculated for the new trade, but didn’t get set as new orders, the old STOP/TARGET levels are still in affect.

     

    So if the price is in a down trend , but took a long trade before price fell, the set stop is below the price and you eventually get stopped out.

    If price keeps falling and there a new long entry, the old stop is now above the new entry level, so it gets stopped out immediately before it can set the new STOP/TARGET.

    ivanPrt and Schizophunk thanked this post
    #246169 quote
    Schizophunk
    Participant
    New

    Appreciate your help @druby

Viewing 3 posts - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.

Strategy GBPJPY 1H


ProOrder: Automated Strategies & Backtesting

New Reply
Author
Summary

This topic contains 2 replies,
has 2 voices, and was last updated by Schizophunk
10 months ago.

Topic Details
Forum: ProOrder: Automated Strategies & Backtesting
Language: English
Started: 03/31/2025
Status: Active
Attachments: No files
Logo Logo
Loading...