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
    robdavrobdav
    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
    NicolasNicolas
    Keymaster
    Legend
    Seems like an ordinary “takeprofit” to me?
    set target pprofit 15 //close an order in profit of 15 points
    #20090 quote
    robdavrobdav
    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
    NicolasNicolas
    Keymaster
    Legend
    Takeprofit are individual for each order with ProOrder IG.
    #20104 quote
    robdavrobdav
    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
    ElsborgtradingElsborgtrading
    Participant
    Veteran
    if close>=open+25*pipsize then
    sell at market
    endif
    robdav and DarkNephilim thanked this post
    #54867 quote
    DarkNephilimDarkNephilim
    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.
ProRealAI ProRealAI New

Stuck on this ProBuilder code?

Describe what this topic is trying to build, in plain English, and ProRealAI writes the ProRealTime™ indicator, screener or system for you.

Available in 7 languages
Try ProRealAI

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 DarkNephilimDarkNephilim
8 years, 9 months ago.

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