Any questions from newcomers on MQL4 and MQL5, help and discussion on algorithms and codes - page 1507 1...150015011502150315041505150615071508150915101511151215131514...1965 New comment Vitaly Muzichenko 2021.06.19 20:17 #15061 MakarFX:Is there any way to determine the number of open charts? Fixed it to 100. If you need to find one thing, then return after finding it, so you don't have to keep running the loop Tretyakov Rostyslav 2021.06.19 20:30 #15062 Vitaly Muzichenko:Corrected to 100. If you need to find one thing, then after you have found it, return, so you don't have to keep running the loop I need to run the loop on every tick, so I made it like this long currChart=ChartFirst(); double pr; int vdigits; int i=0; while(i<=CHARTS_MAX) { if(currChart<0) break; if(ObjectFind(currChart,ChartSymbol(currChart)+" BUY")==0) { pr=ObjectGetDouble(currChart,ChartSymbol(currChart)+" BUY",OBJPROP_PRICE1); vdigits = (int)MarketInfo(ChartSymbol(currChart),MODE_DIGITS); Print(i," ",ChartSymbol(currChart)," ",DoubleToStr(pr,vdigits)); }else{Print(i," ",ChartSymbol(currChart)," 0");} currChart=ChartNext(currChart); i++; } [Deleted] 2021.06.19 20:31 #15063 what if two "something-ones" are open? why not keep racing? [Deleted] 2021.06.19 20:47 #15064 MakarFX:I need to run a loop on every tick maybe think of doing something withCHARTEVENT_CUSTOM. Tretyakov Rostyslav 2021.06.19 20:53 #15065 Aleksei Stepanenko: maybe think of doing something withCHARTEVENT_CUSTOM somehow. Not an option...need to check it without my involvement. The code above seems to work correctly, but since I'm a weak programmer, I wanted to see the opinion of more experienced and knowledgeable people. ...long wait until Monday to test it ( mtf indicator can not How much does it Request for trend line [Deleted] 2021.06.19 20:56 #15066 So the programme can listen to the air instead of the cycle without your involvement too, no? Tretyakov Rostyslav 2021.06.19 20:58 #15067 Aleksei Stepanenko: So the programme can listen to the airwaves without your involvement too, no? I don't get it... [Deleted] 2021.06.19 21:06 #15068 I haven't looked into it, but I think you could assign an event to each graph and then wait for it in the OnChartevent... Don't know, but hopefully Maxim Kuznetsov 2021.06.19 21:07 #15069 MakarFX:I need to run a loop on every tick, so I did it this way You don't need to pull crap from help, write an obvious loop... you'll have to live with it later :-) for(long chartId=ChartNext(0);chartId>0 &&!IsStopped();chartId=ChartNext(chartId)) { if (ChartSymbol(chartId)=="") continue; DoChart(chartId); } Tretyakov Rostyslav 2021.06.19 21:21 #15070 Aleksei Stepanenko: I haven't studied the question, but I think you can assign an event to each chart and then wait for it in OnChartevent... Alexei, to be honest, with my knowledge it sounds scary... I need to keep it simple, find an object to buy-buy, find an object to sell-sell. 1...150015011502150315041505150615071508150915101511151215131514...1965 New comment
Is there any way to determine the number of open charts?
Fixed it to 100.
If you need to find one thing, then return after finding it, so you don't have to keep running the loop
Corrected to 100.
If you need to find one thing, then after you have found it, return, so you don't have to keep running the loop
I need to run the loop on every tick, so I made it like this
what if two "something-ones" are open?
why not keep racing?
I need to run a loop on every tick
maybe think of doing something withCHARTEVENT_CUSTOM.
maybe think of doing something withCHARTEVENT_CUSTOM somehow.
Not an option...need to check it without my involvement.
The code above seems to work correctly, but since I'm a weak programmer, I wanted to see the opinion of more experienced and knowledgeable people.
...long wait until Monday to test it (
So the programme can listen to the airwaves without your involvement too, no?
I need to run a loop on every tick, so I did it this way
You don't need to pull crap from help, write an obvious loop... you'll have to live with it later :-)
for(long chartId=ChartNext(0);chartId>0 &&!IsStopped();chartId=ChartNext(chartId)) {
if (ChartSymbol(chartId)=="") continue;
DoChart(chartId);
}
I haven't studied the question, but I think you can assign an event to each chart and then wait for it in OnChartevent...
Alexei, to be honest, with my knowledge it sounds scary...
I need to keep it simple, find an object to buy-buy, find an object to sell-sell.