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 CaptainJack, 05-29-2026, 05:09 AM
    0 responses
    232 views
    0 likes
    Last Post CaptainJack  
    Started by CaptainJack, 05-29-2026, 12:02 AM
    0 responses
    149 views
    0 likes
    Last Post CaptainJack  
    Started by charlesugo_1, 05-26-2026, 05:03 PM
    0 responses
    161 views
    1 like
    Last Post charlesugo_1  
    Started by DannyP96, 05-18-2026, 02:38 PM
    1 response
    243 views
    0 likes
    Last Post NinjaTrader_ChelseaB  
    Started by CarlTrading, 05-11-2026, 05:56 AM
    0 responses
    198 views
    0 likes
    Last Post CarlTrading  
    Working...
    X