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 CarlTrading, 03-31-2026, 09:41 PM
    1 response
    63 views
    0 likes
    Last Post NinjaTrader_ChelseaB  
    Started by CarlTrading, 04-01-2026, 02:41 AM
    0 responses
    35 views
    0 likes
    Last Post CarlTrading  
    Started by CaptainJack, 03-31-2026, 11:44 PM
    0 responses
    54 views
    1 like
    Last Post CaptainJack  
    Started by CarlTrading, 03-30-2026, 11:51 AM
    0 responses
    61 views
    0 likes
    Last Post CarlTrading  
    Started by CarlTrading, 03-30-2026, 11:48 AM
    0 responses
    48 views
    0 likes
    Last Post CarlTrading  
    Working...
    X