Start of Pro Order Autotrade looks at previous historical candle

Forums ProRealTime English forum ProOrder support Start of Pro Order Autotrade looks at previous historical candle

  • This topic has 11 replies, 4 voices, and was last updated 4 years ago by avatarAlun.
Viewing 12 posts - 1 through 12 (of 12 total)
  • #155615

    Is there a way for my code to ignore the previous candle close condition when it first starts?

    I would like the code to look for the condition only from the first candle after the automatic trade has started.

     

    #155621

    I think ProOrder does what you say by default. If you have a daily timeframe and you start your robot at noon, your robot wont do anything before midnight, even if the buy conditions were met at midnight the day before.

    Maybe another member can confirm what I say.

    #155664

    Yes above is correct … Algo code would be read at end of the first complete candle after starting Algo … no matter what the TF.

    Somehow I think the OP means / is asking something else??

    #155737

    When I started my code, there was already a daily green candle >8ema completed on the chart from the previous day. It looks like the code (or robot) read the previous green candle as >8ema even though the first candle after starting the code was a red candle closing below the 8ema. The code looks for Open>8ema[1], Close>8ema[1] and Close>Open.

    I am not sure why the code seems to have read the previous candle as satisfying my code criteria, and executed a buy at market above the first red candle.

    #155743

    When I started my code, there was already a daily green candle >8ema completed on the chart from the previous day.

    The first two conditions below fit the scenario above and so a trade would execute (at the open of the next candle) if Close > Open on the current candle?

    Open>8ema[1], Close>8ema[1] and Close>Open.

     

    Alun wrote:

    code to ignore the previous candle close condition when it first starts?

    To get above, you would need your code written as …

     

    Let us know if it works?

     

    #155749

    Providing this is a valid expression, would the IF criteria “Today[0] > 202012029” prevent the code from using the candle before the code started.

    OR

    Is there a slight “bug” going on where the code has been triggered just before the start of the new candle? Should I start the code at a time (5 or 10 minutes) just after the market has opened to allow the first candle to start forming to avoid this issue?

    #155750

    Thank you GraHal for your suggestion. I would like the current candle to open and close > the previous 8ema (not the current 8ema):-

    Open>8ema[1] AND Close>8ema[1] and Close>Open

    So I want the code to use the candle that appears after starting the code (not the candle before the code started) and compare the Open and Close to the previous 8ema.

    #155772

    Are you saying you want the above to be read at end of the candle following the candle on which you start your code?

    EDIT / PS
    NOTE: In the above condition, EMA is for 8 periods and so will use candle values for the previous 7 candles + the candle value of the candle on which the code is read, i.e. the current candle.

    #155782

    Apologies if my explanations are confusing. Here is the code and a screen shot (see the attachment) of what actually happened. I started the autotrade code at  22:15 on 28th Dec on the daily timeframe after the Inverted Hammer had formed (d’ly). The next day it immediately opened a position at 88.8 – it took the previous days’ inverted hammer candle as satisfying the criteria below when the market opened the following day on 29th Dec. The light blue line is the 8ema.

    Is it possible to have the code ignore the previous days candle only when the code starts (but not on subsequent days after the code continues to run)?

     

     

     

    #155796

    Alun – Please follow the forum rules and use the ‘Insert PRT Code’ button when putting code in your posts. I tidied up your post.

    #155799

    Your description is confusing. Your strategy did what is normal. All code is read through at the close of a candle and orders sent to the market at the open of the following candle. So if at the close of the first candle your entry conditions are met your trade will open at the opening of the following candle. If you want to skip a candle then just start a count and don’t trade until it is 2.

     

    1 user thanked author for this post.
    #155801

    Many thanks for clarifying and advising the solution, Vonasi. Apologies again for any confusion!

Viewing 12 posts - 1 through 12 (of 12 total)

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