Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Swami indicator

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

    Swami indicator

    Great coding!
    I tried replacing stochastics with macd using

    iValues[x].Set(MACD(3,x + minLength, 3)[0] * 0.01);

    but get no plot and no error messages.
    Can you tell me where I am going wrong?

    #2
    mindset,

    Please try removing the [x] in iValues[x]

    Also, if it continue to not work please post more of your code.
    Adam P.NinjaTrader Customer Service

    Comment


      #3
      Makes no sense?

      Here is the complete code - as produced by NT.

      Code:
      	protected override void OnStartUp()
      		{
      			iValues 		= new DataSeries[maxLength - minLength + 1];
      			for(int i = 0; i < iValues.Length; i++)
      				iValues[i] = new DataSeries(this);
      		}
      
              protected override void OnBarUpdate()
              {
      			if(CurrentBar < maxLength) return;
      			for(int x = 0; x < iValues.Length; x++)
      			//	iValues[x].Set(Stochastics(3, x + minLength, 3)[0] * 0.01);//original line ( works)
      			iValues[x].Set(MACD(3,x + minLength, 3)[0] * 0.1);// new line for macd ( fails)
      		
      
              }

      Comment


        #4
        Hi Mindset,

        Thanks for the feedback. The value needs to fall between 0 and 1 for the Swami code to work. Stochastic is normalized this way by multiplying by .01, and raw MACD values can't directly be used the same way.

        MACD may not be easily "swamized", since there are two "Period" components in its calculation, and the script is designed with only one in mind.

        To normalize any indicator, you can apply stochastics to it and multiply by .01, but will have to consider that not everything will easily fit this style of indicator.
        Ryan M.NinjaTrader Customer Service

        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