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 f.saeidi, Today, 05:56 AM
        2 responses
        8 views
        0 likes
        Last Post NinjaTrader_Erick  
        Started by Pattontje, Yesterday, 02:10 PM
        2 responses
        35 views
        0 likes
        Last Post Pattontje  
        Started by xiinteractive, 04-09-2024, 08:08 AM
        7 responses
        27 views
        0 likes
        Last Post NinjaTrader_Erick  
        Started by Skifree, Today, 03:41 AM
        2 responses
        8 views
        0 likes
        Last Post NinjaTrader_ChelseaB  
        Started by trimpy, Today, 04:38 AM
        1 response
        7 views
        0 likes
        Last Post NinjaTrader_Jesse  
        Working...
        X