Coding help - page 444

 
jizzle15:
Yes this is how it looks. (the red line are supposed to display the previous daily weekly and monthly high and low) but as you can see there is a huge number of lines..if i click on each of them there is a label that display ex:Previous dailyHigh[8] and another would be Previous dailyHigh[7]

Thanks for your help Mladen

It looks like this when I attach it to the chart :

Are you trying t use multiple instances of the indicator on the same chart

Files:
pivots.gif  32 kb
 

No, i just changed the line style in the indicator setting box so it's easier to see. But as you can see, there are the levels in front of the labels, and some extra lines that i don't know what they are referring to

 
mladen:
'

Try like this :

long current = ChartFirst();

while (true)

{

if (ChartSymbol(current)=="CADCHF" && ChartPeriod(current)==PERIOD_H1) break;

current = ChartNext(current); if (current==-1) break;

}

if (current!=-1)

if (!ObjectCreate(current,name, OBJ_ARROW, 0, TimeCurrent(),MarketInfo("CADCHF",MODE_BID)))

{

Alert("Error creating object: ",GetLastError());

return;

}

[/PHP]

Or if you want to draw that object on each and every CADCHF H1 chart, do it like this :

[PHP]long current = ChartFirst();

while (true)

{

if (ChartSymbol(current)=="CADCHF" && ChartPeriod(current)==PERIOD_H1)

{

if (!ObjectCreate(current,name, OBJ_ARROW, 0, TimeCurrent(),MarketInfo("CADCHF",MODE_BID)))

{

Alert("Error creating object: ",GetLastError());

break;

}

}

current = ChartNext(current); if (current==-1) break;

}

it would be nice if he found the solution

 
morenokosta:
it would be nice if he found the solution

That is the solution (both solutions are working - tested it)

 
mladen:
That is the solution (both solutions are working - tested it)

I am very happy, and how do I compile the code by yourself posted

 
morenokosta:
I am very happy, and how do I compile the code by yourself posted

That is not an indicator, or an ea or a script

The man asked for a solution for a specific problem (see his original post here : original request from sunshineh ). Those two are solutions for his specific problem. If you want to see how it can be applied in an indicator, for example, here is one example :

#property indicator_chart_window

int init() { return(0); }

int deinit() { return(0); }

void start(void)

{

string name = "test";

long current = ChartFirst();

while (true)

{

if (ChartSymbol(current)=="CADCHF" && ChartPeriod(current)==PERIOD_H1)

{

if (!ObjectCreate(current,name, OBJ_ARROW, 0, TimeCurrent(),MarketInfo("CADCHF",MODE_BID)))

{

Alert("Error creating object: ",GetLastError());

break;

}

}

current = ChartNext(current); if (current==-1) break;

}

return;

}

_test_1.mq4

Attach it to any chart and then open as many CADCHF 1 hour charts you want, go to the chart where you attached the _test indicator, wait for a tick or, today, change a time frame, and then check all the CADCHF charts - on all you will see one arrow created. That is what sunshineh's problem was and that is what that code was supposed to do

happy trading

Files:
_test_1.mq4  1 kb
 
mladen:
That is not an indicator, or an ea or a script

The man asked for a solution for a specific problem (see his original post here : original request from sunshineh ). Those two are solutions for his specific problem. If you want to see how it can be applied in an indicator, for example, here is one example :

#property indicator_chart_window

int init() { return(0); }

int deinit() { return(0); }

void start(void)

{

string name = "test";

long current = ChartFirst();

while (true)

{

if (ChartSymbol(current)=="CADCHF" && ChartPeriod(current)==PERIOD_H1)

{

if (!ObjectCreate(current,name, OBJ_ARROW, 0, TimeCurrent(),MarketInfo("CADCHF",MODE_BID)))

{

Alert("Error creating object: ",GetLastError());

break;

}

}

current = ChartNext(current); if (current==-1) break;

}

return;

}

_test_1.mq4

Attach it to any chart and then open as many CADCHF 1 hour charts you want, go to the chart where you attached the _test indicator, wait for a tick or, today, change a time frame, and then check all the CADCHF charts - on all you will see one arrow created. That is what sunshineh's problem was and that is what that code was supposed to do

happy trading

thank you, i try it and let you know

 
mladen:
It looks like this when I attach it to the chart :

Are you trying t use multiple instances of the indicator on the same chart
Re: Coding help
No, i just changed the line style in the indicator setting box so it's easier to see. But as you can see, there are the levels in front of the labels, and some extra lines that i don't know what they are referring to
 
jizzle15:
Re: Coding help
No, i just changed the line style in the indicator setting box so it's easier to see. But as you can see, there are the levels in front of the labels, and some extra lines that i don't know what they are referring to

Sorry. Can not find what is going on with it

 
mladen:
Sorry. Can not find what is going on with it

Ok no problem, i will use it just like that thanks

Reason: