Question on coding MTF: tradeindex

Forums ProRealTime English forum ProOrder support Question on coding MTF: tradeindex

Tagged: ,

Viewing 6 posts - 1 through 6 (of 6 total)
  • #102273

    So MTF is available to everyone, but weirdly we don’t see a lot of posts related to it. In my opinion because it’s too complicated to code.

    I have a 15min strategy which is working averagely, but that could be improved I think/hope. All my code is on the 15min, but once there is a position, I want to manage it via the 5min. So in my 15min code, I use the snippet “barindex-tradeindex>0” to avoid taking a position if one was just opened before.

    Now in the MTF code, when I test via graph the value of both function, I have tradeindex which is > barindex, which doesn’t seem even possible to me.

    can you see why?

    Second question: is there a way to use a smaller TF which won’t be the main TF in a MTF code? For exemple if I want to know the close value of an index like the Dax which closes at 17h35, I can’t know it if my TF is 15min. Same goes for the open, for which the correct time is rather 09h02 than 09h.

    #102281

    Not so  weird, only available since only 2 weeks. Not everyone is a coder. IG didn’t communicate on it. It’s Summer time! 😀

    Each barindex is different in each timeframe. Same goes for tradeindex. Count of elapsed bars aren’t the same for a 5-min or a 15-min TF.

    The main TF is always the smallest timeframe. Code is still only read one time, at bar closure, so in order to test TIME = 090200, you still need to run the code on a 1-minute timeframe.

    #102391

    thx for your reply Nicolas.

    I’m working with STOP and Limit order in my code, so it’s not always easy to know when a trade has been taken. In a unique timeframe, I use the snippet “barindex-tradeindex=0” to know that a trade has been taken.

    But now in MTF, I get how “barindex” is working, but I still don’t get how “tradeindex” is working. How can you compare both, if they don’t use the same scale?

    #102392

    ok I solved it by using another command, “countofposition”.

    But it’s these little thing which makes the migration of code toward MTF difficult

    #102393

    Since you are launching order on a single TF, TRADEINDEX to used should only compared to the BARINDEX of that TF.

    #102395

    yes that’s what I’m doing, but it doesn’t work. All the barindex and tradeindex functions are used under the same timeframe (15min) but tradeindex never equal barindex….

    Speaking on countofposition, I thought that countofposition[1] would tell me that no trade was opened on the previous bar, but unfortunately this command always return 0 when I graph it…

    Either there are still bugs in the MTF engine, or it’s me.

    So I recode a fake code to explain my problems…The code is without interest, but what is important is the value of barindex, tradeindex in order to be able to compare them. Same with countofposition, how can I get the value of countofposition for the previous bar?

     

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

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