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 SalmaTrader, 07-07-2026, 10:26 PM
    0 responses
    35 views
    0 likes
    Last Post SalmaTrader  
    Started by CarlTrading, 07-05-2026, 01:16 PM
    0 responses
    20 views
    0 likes
    Last Post CarlTrading  
    Started by CaptainJack, 06-17-2026, 10:32 AM
    0 responses
    13 views
    0 likes
    Last Post CaptainJack  
    Started by kinfxhk, 06-17-2026, 04:15 AM
    0 responses
    19 views
    0 likes
    Last Post kinfxhk
    by kinfxhk
     
    Started by kinfxhk, 06-17-2026, 04:06 AM
    0 responses
    21 views
    0 likes
    Last Post kinfxhk
    by kinfxhk
     
    Working...
    X