MTF MA

widhie75

Active Trader
Aug 11, 2013
7
0
37
Ciputat, Indonesia
Hallo...

I try to custom EarnForex 'MTF MA' indicator, but I found problem.

The first and second Moving Average not work as supposed to be.

Can someone here explain a little bit, what I'm missing here.

Thanks
 

Attached File(s)

An indicator can have only one Indicator Short Name property. The one that you set last in the code replaces the first one. An indicator can have a different label for each plot it draws. You can modify them using PlotIndexSetString(). In a mouse-over tip, the indicator's short name is shown at the top and the label is shown at the bottom.

The second half of your OnCalculate() has no chance of executing because you have an unconditional return at line 135.

The "straight" line you see on that screenshot looks rather correctly considering that your default setting is to use the Monthly timeframe for the MA. I'd say that line looks exactly like the monthly TF MA would look on a daily timeframe.
 
An indicator can have only one Indicator Short Name property. The one that you set last in the code replaces the first one. An indicator can have a different label for each plot it draws. You can modify them using PlotIndexSetString(). In a mouse-over tip, the indicator's short name is shown at the top and the label is shown at the bottom.

The second half of your OnCalculate() has no chance of executing because you have an unconditional return at line 135.

The "straight" line you see on that screenshot looks rather correctly considering that your default setting is to use the Monthly timeframe for the MA. I'd say that line looks exactly like the monthly TF MA would look on a daily timeframe.

Thanks Enivid, I'll find out how to use PlotIndexSetString for label, and fix this Monthly-Daily MA issue.
 
Thanks Enivid, I'll find out how to use PlotIndexSetString for label, and fix this Monthly-Daily MA issue.
Hallo again Enivid,

Finally I'm able to fix 'short_name' and 'Moving Average #1 and #2' issue.
Overall, everything works good.

But after few time test, I found other bug.
After attach 3rd indicator 'MTF MA My Custom', there are out of range lines.
This lines appear in Monthly chart, and for lower MTF MA.
This error line price value is 0.0000


I try to put 'Return();' or delete 'continue;' try modify anything else but nothing works.

How to fix this vertical line?
The original 'MTF MA' code, lower TF supposed to be unseen.
 

Attached File(s)

  • 'MTF-MA-My-Custom'-Error-Lines.jpg
    'MTF-MA-My-Custom'-Error-Lines.jpg
    183.6 KB · Views: 5
  • Error-Lines-Value-0.0000.jpg
    Error-Lines-Value-0.0000.jpg
    53.5 KB · Views: 5
  • MTF_MA My Custom.mq5 12.5 KB Views: 5