MQL4 - automated forex trading   /  

Forum

dots on the chart

Back to topics list To post a new topic, please log in or register

avatar
2
ajforex 2007.08.31 09:40 

Help with dots on the chart

I am trying to place dots on the charts whenever there is condition.

eg

if close[0] > High[1]

{

ObjectSet("ArrowB",OBJPROP_COLOR, Green);
ObjectSet("ArrowB", OBJPROP_ARROWCODE, 159);
ObjectSet("ArrowB", OBJPROP_TIME1, Time[0]);
ObjectCreate ("ArrowB",OBJ_ARROW,0,TimeCurrent(),0,Bid);

}

the issue is the dot is keep on moving, can somebody please help to create dot on every bar. The picture attached is from mql3.

Thanks,
AJ

article

Theoretical Basis of Building Cluster Indicators for FOREX

Cluster indicators are sets of indicators that divide currency pairs into separate currencies. Indicators allow to trace the relative currency fluctuation, determine the potential of formating new currency trends, receive trade signals and follow medium-term and long-term positons.


avatar
364
Irtron 2007.08.31 10:18 
I'm curious why you set object parameters before creating it? It's like watching a program on TV before turning it on. :)

Objects are referred by their names. Hence if you need multiple objects give them unique names.
Either time stamp or shared counter would do.
if (close[1] > High[2])
{
    string name = StringConcatenate("ArrowB ", TimeToStr(Time[1]));
    
    if (ObjectCreate(name, OBJ_ARROW, 0, Time[1], High[1]) // returns false if object exists already.
    {
        // set the properties if ObjectCreate() succeeds and a new arrow is placed on the chart.
        ObjectSet(name, OBJPROP_COLOR, Green);
        ObjectSet(name, OBJPROP_ARROWCODE, 159);
    }
}

avatar
2
ajforex 2007.09.01 07:48 

Hi Irtron,

Thanks for your code, it works. .. I apprecaite for your help. I thought first you set the value and then create it. Create would create a dot. looks it other way around.

Regards,

AJ

Back to topics list  

To add comments, please log in or register