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 traderqz, Today, 12:06 AM
        10 responses
        18 views
        0 likes
        Last Post traderqz  
        Started by algospoke, 04-17-2024, 06:40 PM
        5 responses
        46 views
        0 likes
        Last Post NinjaTrader_Jesse  
        Started by arvidvanstaey, Today, 02:19 PM
        1 response
        6 views
        0 likes
        Last Post NinjaTrader_Zachary  
        Started by mmckinnm, Today, 01:34 PM
        3 responses
        5 views
        0 likes
        Last Post NinjaTrader_ChelseaB  
        Started by f.saeidi, Today, 01:32 PM
        2 responses
        9 views
        0 likes
        Last Post f.saeidi  
        Working...
        X