NexusFi: Find Your Edge


Home Menu

 





divide 2 indicator values


Discussion in NinjaTrader

Updated
    1. trending_up 1,383 views
    2. thumb_up 1 thanks given
    3. group 2 followers
    1. forum 1 posts
    2. attach_file 0 attachments




 
Search this Thread

divide 2 indicator values

  #1 (permalink)
oagento
Österreich
 
Posts: 1 since Sep 2012
Thanks Given: 0
Thanks Received: 0

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

Reply With Quote

Can you help answer these questions
from other members on NexusFi?
ZombieSqueeze
Platforms and Indicators
About a successful futures trader who didnt know anythin …
Psychology and Money Management
NT7 Indicator Script Troubleshooting - Camarilla Pivots
NinjaTrader
Trade idea based off three indicators.
Traders Hideout
MC PL editor upgrade
MultiCharts
 
  #2 (permalink)
 
shodson's Avatar
 shodson 
OC, California, USA
Quantoholic
 
Experience: Advanced
Platform: IB/TWS, NinjaTrader, ToS
Broker: IB, ToS, Kinetick
Trading: stocks, options, futures, VIX
Posts: 1,976 since Jun 2009
Thanks Given: 533
Thanks Received: 3,709


oagento View Post
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).

Follow me on Twitter Visit my NexusFi Trade Journal Reply With Quote
Thanked by:




Last Updated on October 30, 2013


© 2024 NexusFi™, s.a., All Rights Reserved.
Av Ricardo J. Alfaro, Century Tower, Panama City, Panama, Ph: +507 833-9432 (Panama and Intl), +1 888-312-3001 (USA and Canada)
All information is for educational use only and is not investment advice. There is a substantial risk of loss in trading commodity futures, stocks, options and foreign exchange products. Past performance is not indicative of future results.
About Us - Contact Us - Site Rules, Acceptable Use, and Terms and Conditions - Privacy Policy - Downloads - Top
no new posts