MACD / Stoch useage

Posted By: TraderTom

MACD / Stoch useage - 02/25/21 21:22

Hi guys. Have a feeling this will be a fairly simple answer but I'm trying to understand how the indicators with multiple outputs are handles in zorro? In metatrader for example you slected the outputs with buffers and associated numbers.

I know the example code is incorrect but posting it as an example. Say I'm trying to get the MACD histogram output where MACD is in the string of outputs. Or the Stochastic K line for example.

Code
 
function run()
{
	StartDate = 20190101; // start two years ago
	BarPeriod = 15; // minutes per bar bars
	LookBack = 100; // needed for scale()
	var PredictHorizon = -3;

	set(RULES);   // generate signals
	LifeTime = 3; // prediction horizon
	Spread = RollLong = RollShort = Commission = Slippage = 0;
	
	adviseLong(SIGNALS+BALANCED+PEEK,0,
		MidPrice(0),MidPrice(3),priceOpen(0),priceOpen(-3),MACD(priceClose,12,26,9));
	enterLong(); 
}


I know this is probably a very simplistic question but I just can't seem to get my syntax right!
Posted By: jcl

Re: MACD / Stoch useage - 03/05/21 08:33

Read the manual how to call an indicator, and call MACD _before_ the advise function. Then use the returned rMACDHist for the histogram line.
Posted By: Grat

Re: MACD / Stoch useage - 03/05/21 09:49

something like this:

Code
		vars Price = series(priceClose());
		
		vars Fast = series(MACD(Price,12,26,9));
		var 	rSig = rMACDSignal,                             <--- read manual
			rHist=rMACDHist;

              
Posted By: TraderTom

Re: MACD / Stoch useage - 03/05/21 13:13

Thanks!

Chiefengineer being asn helpful and welcoming as ever.....
© 2024 lite-C Forums