Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

can somebody help?

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

    can somebody help?

    hi, I am not good with coding and what I looking for to figure out is how to develop a strategy where I can put SMA + some range eg
    protected override void Initialize()
    {
    SetProfitTarget ("", CalculationMode.Ticks, 4);
    SetStopLoss ("", CalculationMode.Ticks, 2);
    CalculateOnBarClose = false;
    }
    SMA(close, 4)
    if ( price_is_above_SMA_5_ticks )
    {
    enterlong; //only one time, if price pullback (one tick because second is SL) and cross the fifth tick from SMA again, no more opening position
    }
    if ( price_is_bellow_SMA_5_ticks )
    {
    entershort; //only one time
    }
    Last edited by ninoo; 04-17-2010, 03:51 PM.

    #2
    SMA is a dataseries (an array) you must use an index to a specific value.

    Example

    SMA()[0];

    More specifically

    if ( Input[0] > SMA(20)[0] + (5 * TickSize))
    {
    do something;
    }
    Last edited by Sleeping Troll; 04-17-2010, 05:21 PM.

    Comment


      #3
      ninoo, Sleeping Troll's suggestion is a good place to start. Let us know if you have any other questions.
      AustinNinjaTrader Customer Service

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by charlesugo_1, 05-26-2026, 05:03 PM
      0 responses
      56 views
      0 likes
      Last Post charlesugo_1  
      Started by DannyP96, 05-18-2026, 02:38 PM
      1 response
      143 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