- www.mql5.com
Sooooo not much progress.
've found a nice indi for MT4 on forexfactory that was not working. I've managed to make it work so whenever a trade is opened or closed it saves a screenshot.
But the main issue remains - can these screenshots be uploaded to my MQL5 profile > Charts automatically, in the background, as soon as they are taken?
Is this even possible in MT4/MT5, without using an external software, just by indicators, scripts or EAs?
This is what I have now:
//+------------------------------------------------------------------+ //| ScreenShotOnTrade.mq4 | //| nicholishen | //| http://www.reddit.com/u/nicholishenFX | //+------------------------------------------------------------------+ #property copyright "nicholishen" #property link "http://www.reddit.com/u/nicholishenFX" #property version "1.00" #property strict #property indicator_chart_window //+------------------------------------------------------------------+ #include <Arrays\ArrayInt.mqh> #include <ChartObjects\ChartObjectsLines.mqh> double orderpipsprofit; //+------------------------------------------------------------------+ //| | //+------------------------------------------------------------------+ class ScreenShot { private: CArrayInt m_list; bool m_init; int m_magic; string m_folder; int m_orders_total; public: ScreenShot(int magic_number): m_init(false), m_magic(magic_number), m_folder("screenshots\\"+Symbol()+"\\"), m_orders_total(-1) {} void OnInit() { m_list.Clear(); m_init = false; } void Refresh() { if(!m_init) { Init(); return; } int total = OrdersTotal(); if(m_orders_total == total) return; m_orders_total = total; // check for new entries for(int i=0; i<OrdersTotal(); i++) { if(OrderSelect(i,SELECT_BY_POS) && OrderSymbol() == Symbol() && (OrderType()==OP_BUY || OrderType()==OP_SELL) && (m_magic==0 || m_magic==OrderMagicNumber())) { if(m_list.SearchLinear(OrderTicket()) < 0) { m_list.Add(OrderTicket()); string name = m_folder+Symbol()+"_"+string(OrderTicket())+"_ENTRY.png"; ChartScreenShot(0,name,1280,720,ALIGN_RIGHT); } } } // check for new exits for(int i=m_list.Total()-1; i>=0; i--) { bool found = false; for(int j=0; j<OrdersTotal(); j++) { if(OrderSelect(j,SELECT_BY_POS) && OrderTicket() == m_list[i]) { found = true; break; } } if(!found) { if(OrderSelect(m_list[i],SELECT_BY_TICKET) && (OrderType()==OP_BUY || OrderType()==OP_SELL)) { int pipMult=10000; if(StringFind(OrderSymbol(),"JPY",0)!=-1) pipMult=100; orderpipsprofit=(OrderClosePrice()-OrderOpenPrice())*pipMult; string name = m_folder+Symbol()+"_"+string(m_list[i])+"_EXIT.png"; CChartObjectHLine line; line.Create(0,"__templine__",0,OrderClosePrice()); line.Style(STYLE_DASHDOTDOT); line.Description("EXIT Profit : " + DoubleToStr(orderpipsprofit,1) + " pips"); ChartSetInteger(0,CHART_SHOW_OBJECT_DESCR,true); ChartScreenShot(0,name,1280,720,ALIGN_RIGHT); } m_list.Delete(i); } } } protected: void Init() { m_init=true; m_list.Clear(); for(int i=0; i<OrdersTotal(); i++) if(OrderSelect(i,SELECT_BY_POS) && OrderSymbol() == Symbol() && (m_magic==0|| m_magic==OrderMagicNumber())) m_list.Add(OrderTicket()); } }; //+------------------------------------------------------------------+ //--- global vars input int magic = 0; ScreenShot screen_shot(magic); //--- //+------------------------------------------------------------------+ int OnInit() { screen_shot.OnInit(); return(INIT_SUCCEEDED); } //+------------------------------------------------------------------+ //| Custom indicator iteration function | //+------------------------------------------------------------------+ int OnCalculate(const int rates_total, const int prev_calculated, const datetime &time[], const double &open[], const double &high[], const double &low[], const double &close[], const long &tick_volume[], const long &volume[], const int &spread[]) { screen_shot.Refresh(); return(rates_total); } //+------------------------------------------------------------------+ void OnDeinit(const int reason) { screen_shot.OnInit(); } //+------------------------------------------------------------------+
https://www.mql5.com/en/search#!keyword=webrequest&module=mql5_module_codebase
brings you ~50 articles and ~10 examples in the codebase and much more ...
- www.mql5.com
I don't think you can upload the screenshot to the user's profile
The indicator you posted is beautiful but cannot navigate to the chart of the order that closed.
What you'll need is
Monitor all open orders , when an order closes add it to the photo booth queue.
Go to the chart of the order fit it in frame from open to close and save the screenshot.
[you could also include a watermark over the screenshot]
From there however you could upload the screenshot on a telegram channel or group.
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Regarding the Profile > Charts page (https://www.mql5.com/en/users/username/charts), is there a way for the MT5 (or MT4) to automatically upload the chart screenshot every time a trade closes?
And if MT5/MT4 cannot do this by themselves, can anyone suggest an EA/indicator that can do this? Important to specify that if there is an EA, this should be able to monitor all charts while being attached to only one chart - the idea is to monitor and catalogue trades opened/closed by other /EAs.
Thank you.