making an EA using my custom indicators - question -solved

 
Hello

In the last weeks I have made my own indicators that automatically draw trendlines.
One indicator draws one trendline and I have different trendlines (indicators) per timeframe now.
For drawing the trendlines, I didn't use buffers, I only used the formula and then I drew the line with "objectcreate" and "objectset".


Now, I have started to make an EA from it in the form of:
-if it is above that and that line on timeframe x
-if it is above that and that line on timeframe y
....
= buy
...

But I have seen that I probably will only be able to call up those lines and timeframes by using the Icustom function.
And because of this, I need to have buffers, which I didn't use for my trendlines/indicators.

So my question is:
is there another solution than using the Icustom function or do I have to partly rebuild my indicators by implementing buffers?


thx in advance
Steven
 
Archel wrote >>
Hello

In the last weeks I have made my own indicators that automatically draw trendlines.
One indicator draws one trendline and I have different trendlines (indicators) per timeframe now.
For drawing the trendlines, I didn't use buffers, I only used the formula and then I drew the line with "objectcreate" and "objectset".


Now, I have started to make an EA from it in the form of:
-if it is above that and that line on timeframe x
-if it is above that and that line on timeframe y
....
= buy
...

But I have seen that I probably will only be able to call up those lines and timeframes by using the Icustom function.
And because of this, I need to have buffers, which I didn't use for my trendlines/indicators.

So my question is:
is there another solution than using the Icustom function or do I have to partly rebuild my indicators by implementing buffers?


thx in advance
Steven


iCustom will NOT be useful because it only returns the points you used for creating the trendlines. You need more advanced logic to find if the price is above or below the trendline.
I can help you write the EA if you want. let me know your email and I will respond.

Thanks
ForexWatchman
 
ForexWatchman:


iCustom will NOT be useful because it only returns the points you used for creating the trendlines. You need more advanced logic to find if the price is above or below the trendline.
I can help you write the EA if you want. let me know your email and I will respond.

Thanks
ForexWatchman


hmm, I can use objectgetvaluebyshift for the lines on the current chart.
I only need to know how to get it from other charts.

Isn't there some simple solution like:
for chart x
objectgetvaluebyshift

for chart y
objectgetvaluebyshift

?

@forexwatchman.
I know you probably only want to help but I've worked a long time on finding my system (manual), probably almost a 1000 hours,
so I won't give my calculations to somebody else for the smallest problem there occurs with trying to make it automatically. ^^

:)
 
If you can use icustom to return your trendline's price, cant you do a simple check to see if the price is above or below?

double trendlineprice = iCustom(NULL, PERIOD_H1, "trendlinethingo", x, x, Current + 0);

if (ask > trendlineprice) Order = SIGNAL_BUY;

or

double Current_CandleOpen = iOpen(NULL, PERIOD_M30, Current + 0);

if (Current_CandleOpen > trendlineprice) Order = SIGNAL_BUY;
 
No, but I have found a solution.
The problem for your answer is what Forexwatchman said: the buffer only remembers the values of the 2 prices used to draw the trendline, and not the prices of the slope that comes behind it.
But what I now have done is (for if someone ever would need it):

-> in the indicator itself:
-make a formula that calculates the price of the trendline at the current bar: x=price1+((price2-price1)*...)

- in int init:
SetIndexStyle(0,DRAW_LINE);
SetIndexBuffer(0,TrendLine);
SetIndexEmptyValue(0,0.0);

- instead of drawing the trendline I use for manual trading with objectcreate...., I only write this:
TrendLine[0]=x

Then you actually get connected dots with the dot at the current bar= price of the trendline at that bar, if it would be drawn...


-> in EA, something like this:

A= iCustom("EURJPY", PERIOD_M1,"Indicatorname", Blue,0,0);
if (ask >A) Order = SIGNAL_BUY
Reason: