Fx-Agency Advisor 3 Indicator without Buffers:
Say you have an ex4 compiled file for an indicator and no source mq4 file for it. A good example is the Fx-Agency Advisor 3 that I found on ForexWinners. It is an amazing indicator which signals possible reversals quite accurately. This indicator just draws objects and never puts any values in buffers. So, the best way to get values from it is to write your own indicator to run on top of it as a wrapper.
Indicator draws Arrows, Horizontal lines and Fibo objects on screen for:
- Buy Arrow
- Sell Arrow
- Buy Ready
- Buy Level
- Sell Ready
- Sell Level
- 5 Fibo Lines
We need to get all these values into buffers.
Steps to write your new wrapper Indicator:
Vars:
Calculate how many buffers you need and set it in:
#property indicator_buffers 11
Then create arrays for all buffers:
double ArrowBuy[]; double ArrowSell[]; double BuyReady[]; double BuyLevel[]; double SellReady[]; double SellLevel[]; double FibLevel1[]; double FibLevel2[]; double FibLevel3[]; double FibLevel4[]; double FibLevel5[];
Init function:
IndicatorBuffers(11);
Set the indexes and labels:
SetIndexBuffer(0, ArrowBuy); SetIndexBuffer(1, BuyReady); SetIndexBuffer(2, BuyLevel); SetIndexBuffer(3, ArrowSell); SetIndexBuffer(4, SellReady); SetIndexBuffer(5, SellLevel); SetIndexBuffer(6, FibLevel1); SetIndexBuffer(7, FibLevel2); SetIndexBuffer(8, FibLevel3); SetIndexBuffer(9, FibLevel4); SetIndexBuffer(10, FibLevel5); SetIndexLabel(0, "ArrowBuy"); SetIndexLabel(1, "BuyReady"); SetIndexLabel(2, "BuyLevel"); SetIndexLabel(3, "ArrowSell"); SetIndexLabel(4, "SellReady"); SetIndexLabel(5, "SellLevel"); SetIndexLabel(6, "FibLevel 1"); SetIndexLabel(7, "FibLevel 2"); SetIndexLabel(8, "FibLevel 3"); SetIndexLabel(9, "FibLevel 4"); SetIndexLabel(10, "FibLevel 5");
Start Function:
It’s best to just calculate vars for newer bars so use IndicatorCounted() function:
int limit; int counted_bars=IndicatorCounted(); if(counted_bars<0) return(-1); if(counted_bars>0) counted_bars--; limit=Bars-counted_bars;
Add iCustom function for the original indicator with all the Inputs you need:
double trade; trade = iCustom(NULL, 0, "FX-Agency Advisor 3", true,clrYellow,false,clrOrange,false,clrBlack,false,true,true,true,true,true,true, 0,0);
Then loop through all the new bars and:
- Find Object Name String to see if object is actually drawn on screen
- Get Object values using the ObjectGet function
For FX-Agency Advisor 3 we need the arrows first which are of type Arrow Object.
The problem we now face is that the arrow objects are already on screen. So when we check ObjectName exists, it will be true for each bar whether the arrow is on that bar or not.
So we need to also get the time property for arrow object and compare it with the bar’s start time (Time[0]). If it matches means the arrow is for that particular bar.
If arrow is found, then set it’s buffer to 1.
if(StringFind(name, "rrres", 0) > -1) { datetime arrow_time = (datetime)ObjectGet(name, OBJPROP_TIME1); if((double)Time[i] == (double)arrow_time) { ArrowSell[i] = 1; } }
For getting the BUY/SELL Ready and Levels and the Fib values, we just need the OBJPROP_PRICE1 for that particular object.
Download:
Just put all files in this rar in Indicators folder. Then load this indicator in your chart: Fx-Agency_Buffers_Abiroid
Conclusion:
Biggest problem with a wrapper indicator based on Screen objects is that the old previous bars before the indicator’s launch will not have accurate values. Once we start the indicator on screen all the objects will get drawn for the current bar. And so all the previous bars will get those values as well.
If old values are relevant to you then just let the indicator run for a while. But usually we are more interested in the current values, so this shouldn’t be an issue.
I hope this helps you guys. Please write to me in the comments below if you figure out more ways to get the indicator values. Or if you have any questions/suggestions for the code. I will be happy to hear from you.
NICE ONE
This is a good wrapper. Could you also add a buffer for the “daytimeopen” vertical line. A buffer of say 1 when it is LIME green and -1 when it is Red
Can you help with the mt5 version as i needed it for MT5 PLATFORM ??
Sorry I haven’t written an MT5 version.
Don’t really have the hang of MT5 coding yet.