SmartSarb: My Indicators keeps coming up with problems. I am hoping for a simple comment on the chart.
|
|
|
Mate, im new to this forum and still in early learning days, Im sure you were same one day. If it was my code then below is the code.
int counted_bars=IndicatorCounted();
int i;
double FiftyMA ;
double OneSixtyMA ;
double FourHundredMA ;
string Position;
//find index of bar shown at leftmost side of screen
i = Bars-counted_bars-1;
//work from leftmost bar to rightmost bar
while(i>=0)
{
//find current MA value, will also be used as y-coordinate
FiftyMA = iMA(NULL,_Period,50,0,MODE_EMA,PRICE_CLOSE,i);
OneSixtyMA = iMA(NULL,_Period,160,0,MODE_EMA,PRICE_CLOSE,i);
FourHundredMA = iMA(NULL,_Period,400,0,MODE_EMA,PRICE_CLOSE,i);
if(OneSixtyMA > FourHundredMA){
if(FiftyMA > OneSixtyMA){
Position = "Long";
}
}
if(OneSixtyMA < FourHundredMA){
if(FiftyMA < OneSixtyMA){
Position = "Short";
}
}
Mate, im new to this forum and still in early learning days, Im sure you were same one day. If it was my code then below is the code.
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hi all,
I am new to MQL4 coding. I need to write an indicator where it shows the value of previous MA 20 and 8. also if 20 is above 8 then it should be sell else if 8 is above 20 then it should be buy. cant understand how to write, My Indicators keeps coming up with problems. I am hoping for a simple comment on the chart.