divide 2 indicator values - NinjaTrader | futures io social day trading

 Notices

divide 2 indicator values
 Updated: October 30th, 2013 (07:48 PM) Views / Replies: 670 / 1 Created: October 28th, 2013 (10:42 AM) by oagento Attachments: 0

 Welcome to futures io.

# divide 2 indicator values

 October 28th, 2013, 10:42 AM #1 (permalink) Trading Apprentice Österreich   Futures Experience: None Platform: NinjaTrader Favorite Futures: ES,TF,YM   Posts: 1 since Sep 2012 Thanks: 0 given, 0 received divide 2 indicator values Hello! Is there anyone who can help with a strategy that should divide 2 indicator values of 2 different minute periods and go long or short whether the value is below or above zero!? like this: if indicator 1 (1MIN) / indicator 2 (5MIN) < 0 go long and if indicator 1 (1MIN) / indicator 2 (5MIN) > 0 go short THANK YOU in advance for any suggestions! Bernhard Last edited by oagento; October 29th, 2013 at 09:14 AM.

Elite Member
OC, California, USA

Favorite Futures: stocks, options, futures, VIX

Posts: 1,882 since Jun 2009

 This post has been selected as an answer to the original posters question

oagento
 Hello! Is there anyone who can help with a strategy that should divide 2 indicator values of 2 different minute periods and go long or short whether the value is below or above zero!? like this: if indicator 1 (1MIN) / indicator 2 (5MIN) < 0 go long and if indicator 1 (1MIN) / indicator 2 (5MIN) > 0 go short THANK YOU in advance for any suggestions! Bernhard

The actual quotient doesn't matter, if one number is negative then the quotient will be negative (< 0). Otherwise, it will always be > 0

Back to the actual question, let's say the indicators are a MACD. Assuming the primary data series is a 5min chart

Code
 ```// class-level variables private MACD macd2; // MACD on the 5-min private MACD macd1; // MACD on the 1-min```
Then in OnInitialize()

Code
 ```Add("SOMESYMBOL", PeriodType.Minute, 1); macd2 = MACD(Closes[0], 12,9,26); macd1 = MACD(Closes[1], 12,9,26);```
Then in OnBarUpdate()

Code
 ```if (macd1[0] / macd2[0] < 0) EnterLong(); else if (macd1[0] / macd2[0] > 0) EnterShort();```
Something like that (I didn't test this in Ninjatrader).

 The following user says Thank You to shodson for this post:

 futures io > divide 2 indicator values

Upcoming Webinars and Events (4:30PM ET unless noted)

December

Dec 13

## Battlestations! Show us your trading desks w/GFF Brokers (\$750 in Prizes)

January

 Similar Threads Thread Thread Starter Forum Replies Last Post afshinmoshrefi NinjaTrader Programming 2 May 15th, 2013 04:08 PM sniffy NinjaTrader Programming 3 March 17th, 2012 10:09 PM RambleDog EasyLanguage Programming 5 April 11th, 2011 11:28 PM eurostoxx NinjaTrader Programming 1 December 14th, 2009 08:22 AM Saroj NinjaTrader Programming 0 September 5th, 2009 12:02 AM

 Tags code, data, data series, indicator, indicators, macd, ninjatrader, strategy, values