HELP TO CREATE DAILY MACD WITH INTRADAY DATA

Questions about MultiCharts and user contributed studies.
nuno-online
Posts: 174
Joined: 31 Jan 2006
Has thanked: 74 times
Been thanked: 5 times

HELP TO CREATE DAILY MACD WITH INTRADAY DATA

Postby nuno-online » 27 Feb 2012

Hi
is it possible to create a daily Macd with intraday data (to use in radarscreen)?

Above , i have day's Open/High/Low/Close in a indicator but i don't now how to do now!
Thank you for your help

Nuno

Code: Select all

Arrays: Day.Open[10](00), Day.High[10](00), Day.Low[10](00), Day.Close[10](00);

Vars : MaxSize (10), Loop(00), Start(FALSE) ;

If Date[00] > Date[01] then begin
If Start then begin
For Loop = MaxSize DownTo 01 begin
Day.Open[Loop] = Day.Open[Loop - 01];
Day.High[Loop] = Day.High[Loop - 01];
Day.Low[Loop] = Day.Low[Loop - 01];
Day.Close[Loop] = Day.Close[Loop - 01];
end; { for loop }

Plot1[01] (Day.Open[00], "Open ") ; { Left Tic }
Plot2[01] (Day.High[00], "High ") ; { Bar High }
Plot3[01] (Day.Low[00], " Low ") ; { Bar Low }
Plot4[01] (Day.Close[00], "Close") ; { Right Tic }
end; { we have had at least one complete day }

Day.Open[00] = Open ;
Day.High[00] = High ;
Day.Low[00] = Low ;
Day.Close[00] = Close ;

If Start = FALSE then Start = TRUE ;
end ; { first bar of a new day }

If High > Day.High[00] then Day.High[00] = High ;
If Low < Day.Low[00] then Day.Low[00] = Low ;
Day.Close[00] = Close ;

SP
Posts: 465
Joined: 06 Feb 2006
Has thanked: 36 times
Been thanked: 286 times

Re: HELP TO CREATE DAILY MACD WITH INTRADAY DATA

Postby SP » 27 Feb 2012

This is the old code from goose to plot a daily average on intraday charts, maybe it is a way for you to start.

Code: Select all

// !GT_98723_Daily_Avg, v8.8.5822, 14 March 2010

///// Setup /////
[SameTickOpt = True]

INPUTS:
Avg_Days_Length (21) ;

VARIABLES:
Daily_Average( 0 ),
IntrabarPersist Day_Count ( 0 ),
IntrabarPersist Prior_Sum ( 0 ),
Recip_Length( Reciprocal( Avg_Days_Length ) ),
IntrabarPersist Bar_Number ( 0 ),
Session_End_Time( SessionEndTime ( 0, 1 ) ),
IntrabarPersist Adequate_Day_History ( False ) ;

///// Housekeeping -- Find Adequate History /////
if Adequate_Day_History = False and
Date > Date[1] then
begin
Day_Count = Day_Count + 1 ;
Once if BarType = 0 then // if tick/vol bar, adjust end time
Session_End_Time = CalcTime( Session_End_Time, -1 ) ;
end ;

Once ( Day_Count = Avg_Days_Length ) Adequate_Day_History = True ;

///// Program /////
if Adequate_Day_History then
begin

//// Calc History Each New Day ////
if Date > Date[1] and
Bar_Number < CurrentBar then
begin
Prior_Sum = 0 ;
for Value1 = 1 to Avg_Days_Length -1
begin
Prior_Sum = Prior_Sum + CloseD( Value1 ) ;
end ; // summation loop
end ; // find new prior sum on first tick each day

//// Calc Average and Plot Each Tick ////
Daily_Average = ( Prior_Sum + Close ) * Recip_Length ;
Plot1( Daily_Average, "Avg_Day" ) ;

//// No Plot if End Of Bar Except Last Bar of Day ////
if BarStatus(1) = 2 and
Time < Session_End_Time then
NoPlot(1) ; // erase plot

end ; // adequate daily history available
The easier way than native coding it to use ADE/Elcolletion and the ADU MACD indicator.

nuno-online
Posts: 174
Joined: 31 Jan 2006
Has thanked: 74 times
Been thanked: 5 times

Re: HELP TO CREATE DAILY MACD WITH INTRADAY DATA

Postby nuno-online » 28 Feb 2012

SP,

Is it possible to use ADE/Elcolletion in radarscreen?

What is the ADU MACD indicator?

Nuno

User avatar
JoshM
Posts: 2195
Joined: 20 May 2011
Location: The Netherlands
Has thanked: 1542 times
Been thanked: 1565 times
Contact:

Re: HELP TO CREATE DAILY MACD WITH INTRADAY DATA

Postby JoshM » 29 Feb 2012

Is it possible to use ADE/Elcolletion in radarscreen?
Yes, the ADE, ELCollection and the GlobalVariables can be used in the Market Scanner.

nuno-online
Posts: 174
Joined: 31 Jan 2006
Has thanked: 74 times
Been thanked: 5 times

Re: HELP TO CREATE DAILY MACD WITH INTRADAY DATA

Postby nuno-online » 29 Feb 2012

Ok
Have you an example how to use this on scanner?

User avatar
JoshM
Posts: 2195
Joined: 20 May 2011
Location: The Netherlands
Has thanked: 1542 times
Been thanked: 1565 times
Contact:

Re: HELP TO CREATE DAILY MACD WITH INTRADAY DATA

Postby JoshM » 02 Mar 2012

Ok
Have you an example how to use this on scanner?
Yes, I have an example for that.

Please be specific in your questions - an example of what, for what goal, and with which - ADE, ELCollections, or GlobalVariables? And to what do you refer with 'this', and is 'on scanner' something different than 'for use in scanner'?

nuno-online
Posts: 174
Joined: 31 Jan 2006
Has thanked: 74 times
Been thanked: 5 times

Re: HELP TO CREATE DAILY MACD WITH INTRADAY DATA

Postby nuno-online » 03 Mar 2012

JoshM,
i have about 100 stocks in my Multicharts 's scanner
I 'd like to have daily macd for all the stocks
I'd like to have an example:
how to display daily data value in an intradray scanner (1hour) for all my stocks
Does i have to use Ade and how

Nuno

User avatar
JoshM
Posts: 2195
Joined: 20 May 2011
Location: The Netherlands
Has thanked: 1542 times
Been thanked: 1565 times
Contact:

Re: HELP TO CREATE DAILY MACD WITH INTRADAY DATA

Postby JoshM » 03 Mar 2012

JoshM,
i have about 100 stocks in my Multicharts 's scanner
I 'd like to have daily macd for all the stocks
I'd like to have an example:
how to display daily data value in an intradray scanner (1hour) for all my stocks
Does i have to use Ade and how

Nuno
Ah I see. Then you won't need to use the complex things like ADE or ELCollection since you can then just add your Daily MACD indicator to the scanner, and then it will calculate the Daily MACD for each symbol.

Or do you want to calculate one Daily MACD for all your 100 stocks combined (instead of 100 separate daily MACD's)?

nuno-online
Posts: 174
Joined: 31 Jan 2006
Has thanked: 74 times
Been thanked: 5 times

Re: HELP TO CREATE DAILY MACD WITH INTRADAY DATA

Postby nuno-online » 03 Mar 2012

JoshM,
i just want one daily macd for each symbol
In Multicharts scanner (1hour), i can't have two differents data in the same line

i don't want two scanners but just one : an 1 HOUR SCANNER

User avatar
JoshM
Posts: 2195
Joined: 20 May 2011
Location: The Netherlands
Has thanked: 1542 times
Been thanked: 1565 times
Contact:

Re: HELP TO CREATE DAILY MACD WITH INTRADAY DATA

Postby JoshM » 03 Mar 2012

i just want one daily macd for each symbol
Can you post your code example so far? That makes it easier to help and saves others from having to reinvent the wheel. :)

nuno-online
Posts: 174
Joined: 31 Jan 2006
Has thanked: 74 times
Been thanked: 5 times

Re: HELP TO CREATE DAILY MACD WITH INTRADAY DATA

Postby nuno-online » 03 Mar 2012

JoshM

the code is in the first message's topic
I know how to plot macd 12 26 9 in a intraday scanner (1 hour) for each symbol
but i don't know how to plot daily macd 12 26 9 in the same line for each symbol

User avatar
TJ
Posts: 7739
Joined: 29 Aug 2006
Location: Global Citizen
Has thanked: 1032 times
Been thanked: 2221 times

Re: HELP TO CREATE DAILY MACD WITH INTRADAY DATA

Postby TJ » 05 Mar 2012

JoshM

the code is in the first message's topic
I know how to plot macd 12 26 9 in a intraday scanner (1 hour) for each symbol
but i don't know how to plot daily macd 12 26 9 in the same line for each symbol
look up

CloseD

SP
Posts: 465
Joined: 06 Feb 2006
Has thanked: 36 times
Been thanked: 286 times

Re: HELP TO CREATE DAILY MACD WITH INTRADAY DATA

Postby SP » 06 Mar 2012

The attached code plots the daily MACD line based on intraday data using the AvgWhenTrueV2 function (the value is plotted on every intraday bar). Sometimes there are small differences as the accuracy of the daily close on a daily chart and a intraday chart could differ depending on the data vendor. Make sure that you load enough days back on the intraday chart (SlowLength+x).

If you need better solutions i suggest to contact Martin at http://jamstrategytrading.com/HTPack.htm

Code: Select all

inputs: FastLength( 12 ), SlowLength( 26 ) ;

variables:
MyXaverage1(0),MyXaverage2(0),
mMACD(0),MACDAvg(0),
m1( 2 / ( FastLength+ 1 ) ) ,
m2( 2 / ( SlowLength+ 1 ) ) ;

value1 = _AvgWhenTrueV2( Date[1] <> Date, Close[1],FastLength, 1, false ) ;
value2 = _AvgWhenTrueV2( Date[1] <> Date, Close[1],SlowLength, 1, false ) ;

if CurrentBar = 1 then
MyXaverage1= Close
else
MyXaverage1 = value1 + m1* ( Close - value1 ) ;

if CurrentBar = 1 then
MyXaverage2= Close
else
MyXaverage2 = value2 + m2* ( Close - value2 ) ;

mMACD = MyXaverage1 - MyXaverage2 ;


Plot1( mMACD , "MACD" ) ;
Attachments
DAILY MACD WITH INTRADAY DATA.rar
(6.62 KiB) Downloaded 176 times


Return to “MultiCharts”