hey
I have an EA that creates signals for possible buy/sell entries by placing an arrow above/under the signal candle.
my issue is, that depending on the chart where the EA is loaded the arrows are placed too far away or too closely.
please review attached images for examples.
In case of a sell signal I want to position the arrow 20 pips above the High of the signal candle
and in case of a buy to place the arrow 20 pips below the Low of the signal candle.
I’m using following approach for positioning:
// arrow creation
ObjectCreate(0, label_name, OBJ_TEXT, 0, 0, 0);
ObjectSet(label_name, OBJPROP_TIME1, some_time);
ObjectSet(label_name, OBJPROP_PRICE1, price_arr); // calculated price with 20 pips added or subtracted depending on sell/buy
// price calculation
// get digits to correctly add pips
double digs = 1 / MathPow(10, Digits-1);
int num_pips = 20;
// arrow price calculation
double price_arr = (type==SYMBOL_ARROWUP) ? iLow(Symbol(), time_frame, 1)-(num_pips*digs)
: iHigh(Symbol(), time_frame, 1)+(num_pips*digs);
as you can see for instance in de30-too-narrow.jpg the arrow sits too closely while in xauusd the distance is correct.
I just can’t figure it out. tried to incorporate tick_value as well but obviously wrongly.
Can anybody help, please?
thanks in advance