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