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 TradeForge, 04-19-2024, 02:09 AM
        2 responses
        28 views
        0 likes
        Last Post TradeForge  
        Started by aprilfool, 12-03-2022, 03:01 PM
        3 responses
        327 views
        0 likes
        Last Post NinjaTrader_Adrian  
        Started by giulyko00, Today, 12:03 PM
        1 response
        5 views
        0 likes
        Last Post NinjaTrader_BrandonH  
        Started by f.saeidi, Today, 12:14 PM
        1 response
        5 views
        0 likes
        Last Post NinjaTrader_Gaby  
        Started by AnnBarnes, Today, 12:17 PM
        1 response
        2 views
        0 likes
        Last Post NinjaTrader_Zachary  
        Working...
        X