count of bars

Viewing 15 posts - 1 through 15 (of 16 total)
  • #76105

    hi guys,

    i want to count the bars – and exit the market after 16 days /bars.

    i know there is

    but i dont like to use barindex – because it depends on when u started a system or on the chart.

    so i am looking for another try like

     

    is this possible? i just want to exit after x days/bars

    #76107

    I do not understand what the issue is with:

    ….as it works perfectly in all situations for counting how many bars you have been on the market for. When the chart data started is irrelevant as BARINDEX and TRADEINDEX are just a filing system that gives a bar a numerical label.

    I guess you could try something like:

    Not tested and as I say I do not understand why you are trying to re-invent the wheel.

     

    1 user thanked author for this post.
    #76157

    @vonasi – thx for ur quick reply i really thank u!

    i did that at yy3 – but now i get 16 bars – so thats what i meant…. 🙁

    #76163

    The decision to close it is made at the close of the 15th bar but the close does not happen until the open of bar 16 I’m guessing.

    #76165

    hmm thx think thats right – automated trading is at close.. so could be the 16th to exit….

    do u think thats right? i want to say:

    if the profit of the open trade is negative since the bar before, system has to sell this order…

     

     

    #76166

    mmo_vienna, your code

    will never be true (also, SUMMATION lacks what it has to SUM) since N will never be > 15, as you wrote 15 within brackets!

     

    #76167

    yes thats true.. tried some things but dont work :S

    #76168

    if the profit of the open trade is negative since the bar before, system has to sell this order…

     

     

    1 user thanked author for this post.
    #76169

    thx for this!

    but i get negative results :/

    #76171

    but i get negative results :/

    You provide the questions – the answers can not always be guaranteed to be profitable! 🙂

    #76172

    haha yes but shouldn’t the order been closed when i have this code? if profit ist negative then…

    #76173

    Not if on the last bar it was in profit and then on this bar it fell back again into a loss.

    #76175

    so if i want to say if order is negative and stays negative the next bar i have to write it in a loop right?

    #76176

    I’m not certain of what you are trying to achieve. Maybe this?

     

    #76177

    i want to say:

    if my open order is negative -€ since 2 bars or more than -100€ the system must sell this order and buy in other direction

Viewing 15 posts - 1 through 15 (of 16 total)

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