Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

The name "..." does not exist in the current context

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

    The name "..." does not exist in the current context

    I have a whole series of variables that are giving me the above error.

    I do already have them listed as variables.

    Code:
    		
    protected override void OnExecution(IExecution execution)
    {
    if (LongLimit != null && LongLimit == execution.Order)
    {
    if (execution.Order.OrderState == OrderState.Filled)
    {
    ExitLongStop(AvgPrice-(execution.Price - AvgPrice),"LongStopB","LongEntryB");
    }
    				
    /*After the Entry B stop has made it initial move, we then wait for the SMA to catch up to the price. When it catches up, then the Stop loss should trail the SMA. The distance that it trails below the SMA (for longs) will be the ((SignalCandle High) - (Signal Candle Low)*StopPerc). The Trailing Stop should naturally only go up and never go down in case the SMA begins to turn downward. */
    if (SMA(sMAPeriod)[0] - ((SignalHigh - SignalLow)*StopPerc) > LongStopB.StopPrice)
    {
    ExitLongStop(SMA(sMAPeriod) - ((SignalHigh - SignalLow) * StopPerc), "LongStopB", "LongEntryB") ;
    }
    }
    }
    The bits that are not being recognized are:
    • SignalHigh
    • LongLimit
    • AvgPrice
    • SignalLow


    They are established in the Variables section
    • private double SignalHigh
    • private double SignalLow
    • private IOrder LongLimit
    Last edited by jg123; 03-11-2014, 04:24 PM. Reason: correction

    #2
    Hello jg123,

    Thank you for your response.

    Can you provide a screenshot of the errors with the description column expanded to detail the errors? ANd/or can you provide the strategy's .cs file? You will find the file under (My) Documents\NinjaTrader 7\bin\Custom\Strategy.

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by Geovanny Suaza, 02-11-2026, 06:32 PM
    0 responses
    558 views
    0 likes
    Last Post Geovanny Suaza  
    Started by Geovanny Suaza, 02-11-2026, 05:51 PM
    0 responses
    324 views
    1 like
    Last Post Geovanny Suaza  
    Started by Mindset, 02-09-2026, 11:44 AM
    0 responses
    101 views
    0 likes
    Last Post Mindset
    by Mindset
     
    Started by Geovanny Suaza, 02-02-2026, 12:30 PM
    0 responses
    545 views
    1 like
    Last Post Geovanny Suaza  
    Started by RFrosty, 01-28-2026, 06:49 PM
    0 responses
    547 views
    1 like
    Last Post RFrosty
    by RFrosty
     
    Working...
    X