I am hoping someone with more EL experience can tell me what I'm doing wrong in this indicator. I can do a bit of EL coding, but have been baffled by coding indicators that call multiple data streams for their calculation.
I included my code below. In this case, I am trying to write a Paint Bar indicator that will paint a bullish color when:
1. MACD is above its Trigger for data1
2. MACD Hist is above an 8 period trigger for data1
3. MACD is above its trigger for data2
4. MACD Hist is above an 8 period trigger for data2
and a bearish color when opposite.
In other words, a paint bar that gets confirmation from a higher timeframe, and has coding that calls for higher timeframe data to be used to paint lower timeframe bars.
I applied this to a chart with 1 minute YM on data1 and 3 minute YM on data2, with the indicator itself applied to data1. Thus, I'm expecting the indicator to use the 1 minute data unless the code specifally asks for the 3 minute data (data2). If I plot the code below, it paints something else entirely. When I plot the MACD's and Hist's from both timeframes on the chart, The paint does not match any of the four. What am I doing wrong here? I hope there is some EL programmer out there who can set me straight. If you look at the code, you'll note I didn't finish the plot statements. I only plotted the first condition since I was troubleshooting. I'll write the rest of the conditions once I find out where I am going wrong with my EL coding.
Thanks for the help.
MyMACD1 = AverageFC(close, FastLen1) - AverageFC(close, SlowLen1);
Trigger1 = AverageFC(MyMACD1, MACDLen1);
Diff1 = MyMACD1 - Trigger1;
DiffTrig1 = AverageFC(Diff1, TriggerLen1);
MyMACD2 = AverageFC(close data2, FastLen2) - AverageFC(close data2, SlowLen2);
Trigger2 = AverageFC(MyMACD2, MACDLen2);
Diff2 = MyMACD2 - Trigger2;
DiffTrig2 = AverageFC(Diff2, TriggerLen2);
Condition1 = Diff2 >= DiffTrig2;
if condition1 then
plotpb(h,l, "DT2 Up");
CODING help requested for multiple data symbol indicator
Questions about MultiCharts and user contributed studies.
2 posts • Page 1 of 1
- Posts: 7458
- Joined: 29 Aug 2006
- Location: Global Citizen
- Has thanked: 999 times
- Been thanked: 2136 times