#property strict #property script_show_inputs #include <arrays/arraystring.mqh> #include <charts/chart.mqh> #include <chartobjects/chartobjectstxtcontrols.mqh> input uint sleep_seconds = 5; CChart puppet_chart; void OnStart() { puppet_chart.Open(_Symbol, PERIOD_CURRENT); CChartObjectLabel puppet_label; puppet_label.Create(puppet_chart.ChartId(), "__ID__", 0, 5, 5); puppet_label.Anchor(ANCHOR_RIGHT_UPPER); puppet_label.Corner(CORNER_RIGHT_UPPER); puppet_label.Description("CHART IS BEIING CONTROLED BY PUPPET MASTER"); puppet_label.Color(clrRed); while(!IsStopped() && chart_exists(puppet_chart)) if(!cycle_charts()) Sleep(1000); } bool chart_exists(CChart &chart) { for(long i=ChartFirst(); i>=0; i=ChartNext(i)) if(i == chart.ChartId()) return true; return false; } class StrSet : public CArrayString { public: bool Add(const string str) { if(this.SearchLinear(str) >= 0) return false; return CArrayString::Add(str); } }; bool cycle_charts() { StrSet symbols; for(int i=0; OrderSelect(i, SELECT_BY_POS); i++) symbols.Add(OrderSymbol()); int total = symbols.Total(); if(total == 0) return false; int i = symbols.Total() - 1; int j = 0; for(; i>=0; --i) { j = OrdersTotal() - 1; for(; j>=0; --j) { if(OrderSelect(j, SELECT_BY_POS) && symbols[i] == OrderSymbol()) { puppet_chart.SetSymbolPeriod(OrderSymbol(), puppet_chart.Period()); Sleep(sleep_seconds * 1000); break; } } } if(j < 0) return false; return true; }
Hello again,
I think I have gotten a little bit closer to what I want to do with the charts.
void Check(){ TotalSymbols=SymbolsTotal(true); for (int TotalOrders=OrdersTotal();TotalOrders>0;x--) { Watch=SymbolName(x,true); trade=OrderSelect(x,SELECT_BY_POS)==true; ticket= OrderTicket(); Symbol_Ticket_Num[x]=ticket; symbols[x]=Watch; Chart_ID=ChartFirst(); Chart_ID =ChartNext(Chart_ID); if(x==0) break; } }
Hello again,
Now I am very confused.
From the sample in the MQL4 reference.
if(!ChartGetInteger(Chart_ID,CHART_IS_MINIMIZED,true)) { //--- display an error message in the Experts log Alert(__FUNCTION__+", Error Code = ",GetLastError()); // Unknown chart property }
![MQL5 - Language of trade strategies built-in the MetaTrader 5 client terminal](https://c.mql5.com/i/registerlandings/logo-2.png)
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
Hello everyone,
I have recently made a multi currency trading code. I have limited it 8 pairs, currently I use "alt+r" to show all the charts with opened positions.
How could I make the program scroll through the open positions with a full screen for a short period of time of each opened order?
FYI I am using MQL4.