Please help with my code

Questions about MultiCharts and user contributed studies.
DibsTrader
Posts: 7
Joined: 16 Mar 2012
Has thanked: 2 times

Please help with my code

Postby DibsTrader » 16 Mar 2012

Hello, I am receiving a compile error message when loading the below code into MultiCharts. The indicator is designed to create an alert 5 minutes before the end of the hour if the current hourly bar is an 'inside bar' at that time.

Please can anyone tell me what changes are necessary to get this working in MultiCharts?

Code: Select all

// Load 5-minute chart as data1
// Load 60-minute chart as data2

Vars: H60(0), L60(0), pH60(0), pL60(0), Min(0), Inside(FALSE);

Min = MinutesFromDateTime(DateTime data1);

if High data1 > H60 then H60 = High data1 ; // find high of 60-min bar
if Low data1 < L60 then L60 = Low data1 ; // find low of 60-min bar

if Time data1 = Time data2 then begin // find 60-min bars
pH60 = H60; // save final values
pL60 = L60;
H60 = High; // reset values
L60 = Low;
end;

Plot2(H60, "H60");
Plot3(L60, "L60");
Plot5(pH60, "pH60");
Plot6(pL60, "pL60");

if Min = 55 then Plot4(Close, "55"); // plot cyan dot on 55 min bars

Inside = H60 < pH60 and L60 > pL60 ; // define inside bar

if Inside and Min = 55 then
begin
Plot1( Close, "Inside" ) ;
Alert ;
end
else
NoPlot( 1 ) ;

User avatar
ABC
Posts: 718
Joined: 16 Dec 2006
Location: www.abctradinggroup.com
Has thanked: 125 times
Been thanked: 408 times
Contact:

Re: Please help with my code

Postby ABC » 16 Mar 2012

Hi DibsTrader,

the compiler will point you towards the error, it doesn't recognize the word "DateTime". You need to create a variable first with this name and then convert the date and time to datetime to store it within this variable.

Regards,
ABC

DibsTrader
Posts: 7
Joined: 16 Mar 2012
Has thanked: 2 times

Re: Please help with my code

Postby DibsTrader » 19 Mar 2012

Thanks ABC


Return to “MultiCharts”