Dark Theme
Light Theme
Trading Articles
Article Categories
Article Tools
Welcome to NexusFi: the best trading community on the planet, with over 150,000 members Sign Up Now for Free
Genuine reviews from real traders, not fake reviews from stealth vendors
Quality education from leading professional traders
We are a friendly, helpful, and positive community
We do not tolerate rude behavior, trolling, or vendors advertising in posts
We are here to help, just let us know what you need
You'll need to
register in order to view the content of the threads and start contributing to our community.
It's free for basic access, or support us by becoming an Elite Member -- see if you qualify for a discount below.
-- Big Mike, Site Administrator
(If you already have an account, login at the top of the page)
Multi time frame MACD signal help needed
Updated May 29, 2020
trending_up
1,334 views
thumb_up
1 thanks given
group
4 followers
forum
4 posts
attach_file
0 attachments
Multi time frame MACD signal help needed
May 25th, 2020, 02:13 PM
raleigh nc wake
Posts: 10 since May 2020
Thanks Given: 10
Thanks Received: 1
I have assembled the following code to check for MACD crossing on the 15min chart and plotting a signal line on the 5 min. It results in three lines plotting. One for each 5 min candle. My question, is it possible to display only one signal at the last 5 min candle in the 15 min range . Any help is appreciated.
script MACD15 {
input TimeFrame = 5;
def agg = TimeFrame * 60000;
def vClose15 = close(period = agg);
input fastLength = 12;
input slowLength = 26;
input MACDLength = 9;
input averageType = AverageType.EXPONENTIAL;
DEF Value = MovingAverage(averageType, vClose15, fastLength) - MovingAverage(averageType, vClose15, slowLength);
DEF Avg = MovingAverage(averageType, Value, MACDLength);
DEF BULL_MACD = if Value crosses above Avg and Value < 0 then 1 else 0;
PLOT BEAR_MACD = if Value crosses below Avg and Value > 0 then 1 else 0;
}
input fastLength = 12;
input slowLength = 26;
input MACDLength = 9;
input averageType = AverageType.EXPONENTIAL;
DEF Value = MovingAverage(averageType, CLOSE, fastLength) - MovingAverage(averageType, CLOSE, slowLength);
DEF Avg = MovingAverage(averageType, Value, MACDLength);
DEF BULL_MACD = if Value crosses above Avg and Value < 0 then 1 else 0;
DEF BEAR_MACD = if Value crosses below Avg and Value > 0 then 1 else 0;
plot BULL_CONVERGENCE = IF MACD15(15).BULL_MACD then 1 else 0;
AddVerticalLine(BULL_CONVERGENCE, "BULL MACD", Color.CYAN, Curve.FIRM);
plot BEAR_CONVERGENCE = IF MACD15(15).BEAR_MACD then 1 else 0;
AddVerticalLine(BEAR_CONVERGENCE, "BEAR MACD", Color.RED, Curve.FIRM);
Can you help answer these questions from other members on NexusFi?
Best Threads (Most Thanked) in the last 7 days on NexusFi
May 25th, 2020, 04:28 PM
BAKU+AZERBAIJAN
Posts: 1 since Apr 2017
Thanks Given: 2
Thanks Received: 0
NC001
I have assembled the following code to check for MACD crossing on the 15min chart and plotting a signal line on the 5 min. It results in three lines plotting. One for each 5 min candle. My question, is it possible to display only one signal at the last 5 min candle in the 15 min
range . Any help is appreciated.
script MACD15 {
input TimeFrame = 5;
def agg = TimeFrame * 60000;
def vClose15 = close(period = agg);
input fastLength = 12;
input slowLength = 26;
input MACDLength = 9;
input averageType = AverageType.EXPONENTIAL;
DEF Value = MovingAverage(averageType, vClose15, fastLength) - MovingAverage(averageType, vClose15, slowLength);
DEF Avg = MovingAverage(averageType, Value, MACDLength);
DEF BULL_MACD = if Value crosses above Avg and Value < 0 then 1 else 0;
PLOT BEAR_MACD = if Value crosses below Avg and Value > 0 then 1 else 0;
}
input fastLength = 12;
input slowLength = 26;
input MACDLength = 9;
input averageType = AverageType.EXPONENTIAL;
DEF Value = MovingAverage(averageType, CLOSE, fastLength) - MovingAverage(averageType, CLOSE, slowLength);
DEF Avg = MovingAverage(averageType, Value, MACDLength);
DEF BULL_MACD = if Value crosses above Avg and Value < 0 then 1 else 0;
DEF BEAR_MACD = if Value crosses below Avg and Value > 0 then 1 else 0;
plot BULL_CONVERGENCE = IF MACD15(15).BULL_MACD then 1 else 0;
AddVerticalLine(BULL_CONVERGENCE, "BULL MACD", Color.CYAN, Curve.FIRM);
plot BEAR_CONVERGENCE = IF MACD15(15).BEAR_MACD then 1 else 0;
AddVerticalLine(BEAR_CONVERGENCE, "BEAR MACD", Color.RED, Curve.FIRM);
Great job is done.But did U ever use it on real market? Regards,
May 25th, 2020, 05:23 PM
raleigh nc wake
Posts: 10 since May 2020
Thanks Given: 10
Thanks Received: 1
trader 1973,
I use this as part of my scalping routine on a daily basis .
I am confused by your reply. Did you figure out a solution to my problem or just commenting on my code?
If you have a solution, then perhaps I missed it. Either way, thank you for your interest
May 28th, 2020, 05:39 PM
San Diego, CA
Experience: Beginner
Platform: TOS, Sierra
Trading: Emini ES, Crude CL
Posts: 55 since Mar 2019
Thanks Given: 9
Thanks Received: 43
This approach might help. Check the last 3 values of the function must add to 3 as the condition to draw the line.
Code
def bull15 = MACD15(15).BULL_MACD;
def bear15 = MACD15(15).BEAR_MACD;
AddVerticalLine(bull15 + bull15[1] + bull15[2] == 3, "BULL MACD", Color.CYAN, Curve.FIRM);
AddVerticalLine(bear15 + bear15[1] + bear15[2] == 3, "BEAR MACD", Color.RED, Curve.FIRM);
Regards,
JayC
May 28th, 2020, 09:10 PM
raleigh nc wake
Posts: 10 since May 2020
Thanks Given: 10
Thanks Received: 1
Thank you JayC. You provided a perfect solution to my problem. Your help is much appreciated!
Last Updated on May 28, 2020