Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Moving Stops Indicator

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Moving Stops Indicator

    THIS IS AN INDICATOR plot

    I am trying to wrap my head around this Moving Stop

    if ((CurrentBar >= 1) && ((Close[0] > Open[0]) && (Close[1] < Open[1])))


    Value[0] = (Low[1] + (-SubtractTicksforLongStop * TickSize));

    the above finds the first instance, but as more Close > Open occur after the red bar of course the stop is NOW na

    How do I approach retaining the STOP at that level until the next RED bar occurs again followed by a GREEN Bar

    thanks​

    Attempt the long way to just write more condition sets, this compiles but creates an LOG error

    if ((CurrentBar >= 1) && ((Close[0] > Open[0]) && (Close[1] < Open[1])))


    Value[0] = (Low[1] + (-SubtractTicksforLongStop * TickSize));

    if ((CurrentBar >= 1) && ((Close[0] > Open[0]) && (Close[1] > Open[1]) && (Close[2] < Open[2])))


    Value[0] = (Low[2] + (-SubtractTicksforLongStop * TickSize));

    if ((CurrentBar >= 1) && ((Close[0] > Open[0]) && (Close[1] > Open[1]) && (Close[2] > Open[2]) && (Close[3] < Open[3])))


    Value[0] = (Low[3] + (-SubtractTicksforLongStop * TickSize));​

    ERROR error on calling OnBarUpdate method on bar 1. You are accessing an index with a value that is invalid since it is out of range.

    Thanks
    Last edited by DTSSTS; 06-23-2023, 12:05 PM.

    #2
    Disregard overcome

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by cmoran13, Yesterday, 01:02 PM
    0 responses
    23 views
    0 likes
    Last Post cmoran13  
    Started by PaulMohn, 04-10-2026, 11:11 AM
    0 responses
    16 views
    0 likes
    Last Post PaulMohn  
    Started by CarlTrading, 03-31-2026, 09:41 PM
    1 response
    160 views
    1 like
    Last Post NinjaTrader_ChelseaB  
    Started by CarlTrading, 04-01-2026, 02:41 AM
    0 responses
    94 views
    1 like
    Last Post CarlTrading  
    Started by CaptainJack, 03-31-2026, 11:44 PM
    0 responses
    147 views
    2 likes
    Last Post CaptainJack  
    Working...
    X