plot moving avr of 15m timeframe on 5m timeframe notworking

Indicators coded by community members
Message
Author
Alpix
Posts: 1
Joined: Fri Apr 16, 2010 2:37 pm

plot moving avr of 15m timeframe on 5m timeframe notworking

#1 Postby Alpix » Fri Apr 16, 2010 2:48 pm

Hi,

I tried to plot the simple moving avarage of 15 min time frame on 5min chart it does not show anything,I have used the iclose() function.i am looking for multi time frame ma on 5 min chart.


I have attached the code below





Code: Select all


library multima;

uses
  graphics,
  IndicatorInterfaceUnit in 'IndicatorInterfaceUnit.pas',
  TechnicalFunctions in 'TechnicalFunctions.pas';

var

// external parameters

period: integer;          // МА period

Shift: integer;           // shift

// index buffer

SMA: TIndexBuffer;

//---------------------------------------------------------------------------
// Initialization procedure
//---------------------------------------------------------------------------

procedure Init; stdcall;

begin

// Define parameters

IndicatorShortName('kam');

SetOutputWindow(ow_ChartWindow);


// register external parameters

AddSeparator('Common');

RegOption('Period', ot_Integer, period);

SetOptionRange('Period', 1, MaxInt);

period := 8;

RegOption('Shift', ot_Integer, Shift);

Shift := 0;


// Create index buffer

IndicatorBuffers(1);

SMA := CreateIndexBuffer;

SetIndexBuffer(0, SMA);

SetIndexStyle(0, ds_Line, psSolid, 1, clRed);

end;



//---------------------------------------------------------------------------
// Deinitialization procedure
//---------------------------------------------------------------------------

procedure Done; stdcall;

begin

// do nothing

end;

//---------------------------------------------------------------------------
// Calculate single bar
//---------------------------------------------------------------------------

procedure Calculate(index: integer); stdcall;

var

i: integer;

sum: double;

begin

sum := 0;

for i:=index to index + period - 1 do

  begin

       sum := sum + iClose('EURUSD', 15, i + Shift);

       //sum := sum + Close(i + Shift);

  end;

// change index buffer value

SMA[index] := sum/period;

end;

exports

Init, Done, Calculate;

end.

Wessel
Posts: 63
Joined: Tue Oct 12, 2010 6:45 pm

#2 Postby Wessel » Wed Oct 13, 2010 11:28 am

Can please post the solution for this ?
I presume you've found it by now.

Thnx!


Return to “Indicators”

Who is online

Users browsing this forum: No registered users and 28 guests