Barindex – tradeindex trailing stop

Forums ProRealTime English forum ProOrder support Barindex – tradeindex trailing stop

Viewing 5 posts - 1 through 5 (of 5 total)
  • #161997

    Hi there,

    I’m having trouble visualizing how to code a longstop using the following line of code:

    In this example, the system will stop immediately because the indicator has received a parameter that isn’t a number (that’s what PRT says even though I’m not sure to understand this.)

    Be that as it may, to thwart this, I simply modified the previous line of code like this:

    Now the question that I’m asking myself is whether I need to update the close into Close[1] so as to include the close at the moment I’m in the market in my longstop?

    Because BarIndex has been artificially advanced, does that mean that I have to go back further in time in order for the longstop to take into consideration the close at the moment I’m in the market?

    I would assume so but I’d like a second opinion! Thanks for getting back to me, would be much appreciated!

    #162011

    In your first example at extremes barindex tradeindex can be 0 (which returns an error) or a huge number (such as 1450 or 21716,…).

    In your second example, say barindex= 280 and tradeindex=275, the difference is 6, that is CLOSE[0] (which is barindex 280) through CLOSE[5] (which is barindex  275), so you do NOT need to use [1] next to CLOSE.

     

     

    #162014

    I forgot to mention that the longstop also needs to kick in at the very next bar I’m in the market – like a normal stop behavior sort to speak! Does that change anything?

    #162018

    No, it doesn’t, since BARINDEX will increase and the result of the expression will, as well. Nothing changes!

     

    1 user thanked author for this post.
    #162022

    Okay, thanks a lot! I guess i got confused because of the addition of that +1 constant 🙂

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

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