Adding an Indicator Moving Average to a Volume Tick Chart.

To add comments, please log in or register
Maion
12
Maion  

Hi there,

 Just starting with Expert Advisor Programming and at this forum, so... here is my question: How to add MA to Volume Chart through coding?

 I know how to drag and drop the MA to the Volume chart at Metatrader 5, but not how to do it programming (EA).  

 I have created a graph (TickVolume), and I want to add a Moving Average (VolMA) to it (at Expert Advisor).

#include <Indicators\Indicators.mqh>
CiVolumes TickVolume;
CiMA VolMA;


input int VolMAPeriod = 10;
input ENUM_MA_METHOD VolMAMethod = 0;
input int VolMAShift = 0;
input ENUM_APPLIED_PRICE VolumeMAPrice = What?????;


int OnInit()
{
int VolHandle = TickVolume.Create(_Symbol,_Period,VolApplied);
VolMA.Create(NULL,_Period,VolMAPeriod,VolMAShift,VolMAMethod,What??????);
//(...)
}

 Doing by drag and drop at MT5, I just tell to Apply to: "First Indicator's Data", but I don't know how to do it by coding.

 Any help?

Thank you for the support! 

Alain Verleyen
36131
Alain Verleyen  
VolMA.Create(NULL,_Period,VolMAPeriod,VolMAShift,VolMAMethod,VolHandle);
Maion
12
Maion  
angevoyageur:

Hello, angevoyageur.

Thank you, I have tried this without sucess.

 As you can see, the MA(red line) is being attached to the Price graph, not to the Volume.

        int VolHandle = TickVolume.Create(_Symbol,_Period,VolApplied);
         VolMA.Create(NULL,_Period,VolMAPeriod,VolMAShift,VolMAMethod,VolHandle);

 MA not at Volume Graph

Any suggestion?

 

Tnks! 

Maion
12
Maion  

Hello guys,

 I was not able to figure out yet what I am doing wrong.

 As I said, I am a begginer...

 I cannot add the indicator to the right graph (volume), it is added to the main graph.

 Help!!

 Tnks! 

To add comments, please log in or register