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 charlesugo_1, 05-26-2026, 05:03 PM
    0 responses
    52 views
    0 likes
    Last Post charlesugo_1  
    Started by DannyP96, 05-18-2026, 02:38 PM
    1 response
    142 views
    0 likes
    Last Post NinjaTrader_ChelseaB  
    Started by CarlTrading, 05-11-2026, 05:56 AM
    0 responses
    160 views
    0 likes
    Last Post CarlTrading  
    Started by CarlTrading, 05-10-2026, 08:12 PM
    0 responses
    96 views
    0 likes
    Last Post CarlTrading  
    Started by Hwop38, 05-04-2026, 07:02 PM
    0 responses
    276 views
    0 likes
    Last Post Hwop38
    by Hwop38
     
    Working...
    X