multiple events on a single bar – multitimeframe?

Forums ProRealTime English forum ProOrder support multiple events on a single bar – multitimeframe?

Viewing 4 posts - 1 through 4 (of 4 total)
  • #81836

    Hi there

    I wrote a simple code that takes the high/low of the market at close time and sets a buy/sell orders.

    The buy/sell orders should only be called once per day.

    I used an hourly time frame but I see that sometimes the orders are called more than once a day. It happens when the order was triggered and successful on the same bar.

    So on the next bar there was no time to set a flag to state that the order was already ONMARKET to prevent it from going in again.

    If I move the time frame to 1 second or even 1 minute this problem will probably not occur or occur less often but then I would not have access to enough historical data.

    I am attaching this simple code snippet.

    Is this a multiframe issue? is there any simple solution for this?

    Any advice would be welcomed

    Thanks in advance

     

    #81838

    This is a version supporting MTF (I only have tested it for syntax errors):

    This will set WasInMarketFlag once in a 1-Minute TF and will be cleared each new day, so your 1-hour TF will not enter any longer for the rest of the trading day.

    You will have less history.

    If you don’t want to use MTF, then you would be able to know you were ONMARKET by checking STRATEGYPROFIT against its initial value saved at the beginning of each new day, something like:

     

     

    #81847

    You will have less history.

    Thats great! thank you so much for this.

    A question about the “less history” part.

    Does it meant that MTF will always give the amount of data based on the lower time frame (so 1 sec time frame will have a few days even if the “main” code is based on daily)

     

    Thanks again

    Alan

    #81848

    Yes, the importance of the TF is just the opposite in MTF.

    MTF recognizes the lowest TF as the main TF, the one used to launch your strategies on which BARINDEX, TRADEINDEX, INTRADAYBARINDEX, ONMARKET and so on… are updated.

    All other TF’s must be multiple of the lower ones and variables can be created/changed only in one TF but read by any TF.

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

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