Close position on difference from open to close of a candle of a certain size

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #20042 quote
    robdav
    Participant
    Veteran

    Hi

    I would like to be able to close a position based on the closing size of a candle. So, if the candle closes X pips/points higher or lower than it opened then close the trade.

    Can anyone help with code for this condition please?

    Thanks

    Robert

    #20069 quote
    Nicolas
    Keymaster
    Master

    Seems like an ordinary “takeprofit” to me?

    set target pprofit 15 //close an order in profit of 15 points
    #20090 quote
    robdav
    Participant
    Veteran

    Well, I only want it to occur should it happen during a trade. I don’t want to set a system wide takeprofit. Does that make sense?

    #20091 quote
    Nicolas
    Keymaster
    Master

    Takeprofit are individual for each order with ProOrder IG.

    #20104 quote
    robdav
    Participant
    Veteran

    Hi Nicolas

    So does this scenario make sense.

    I’m coding a system which has the default DEFPARAM CumulateOrders = False set. Therefore, my understanding is that I can only have one buy or sell order in the market at a time, correct?

    One position might hit a candle which goes up or down 30 points. Some may not hit such candles but over the position move 150 points.

    If I set a take profit of say 25 then both trades would be closed at 25 points, would they not?

    Thanks

    Robert

    #20106 quote
    Elsborgtrading
    Participant
    Veteran
    if close>=open+25*pipsize then
    sell at market
    endif
    robdav and DarkNephilim thanked this post
    #54867 quote
    DarkNephilim
    Participant
    New

    Thank you Elborg, I was looking for encoding the size of a candle For 3 days, thanks a lot !

     

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

Close position on difference from open to close of a candle of a certain size


ProOrder: Automated Strategies & Backtesting

New Reply
Author
author-avatar
robdav @robdav Participant
Summary

This topic contains 6 replies,
has 4 voices, and was last updated by DarkNephilim
8 years, 3 months ago.

Topic Details
Forum: ProOrder: Automated Strategies & Backtesting
Language: English
Started: 01/06/2017
Status: Active
Attachments: No files
Logo Logo
Loading...