Is there already a solution to automate these:
- right click
- save picture as
- active chart (as is)
- save into IIS image webfolder where I can open from phone's web browser
Hi, Please specify what you mean by "save picture as". Do you need to save a screenshot of the entire screen, MT5 terminal window or just an MT5 chart?
on my mt4, I want to save current H1 chart with heiken ashi bar chart. Just the graf like this
#property copyright "Copyright 2015, MetaQuotes Software Corp." #property link "https://www.haskayayazilim.com" #property version "1.00" #property strict //+------------------------------------------------------------------+ //| Expert initialization function | //+------------------------------------------------------------------+ datetime prevtime; int ExtShotsCounter; int OnInit() { //--- //--- return(INIT_SUCCEEDED); } //+------------------------------------------------------------------+ //| Expert deinitialization function | //+------------------------------------------------------------------+ void OnDeinit(const int reason) { //--- } //+------------------------------------------------------------------+ //| Expert tick function | //+------------------------------------------------------------------+ void OnTick() { //--- SaveGraph(); } //+------------------------------------------------------------------+ int SaveGraph() { if(iTime(Symbol(),60,0) == prevtime) return(0); prevtime = iTime(Symbol(),60,0); ExtShotsCounter++; WindowScreenShot("shots\\tester"+ExtShotsCounter+".gif",640,480); return(0); }
on my mt4, I want to save current H1 chart with heiken ashi bar chart. Just the graf like this
You can use an easy solution like the one I provided below, or you can build on it.
Please note that MT4 will not let you write outside of the {MT4 Data Folder} / MQL4 / Files folder so you can do a simple trick and add a symlink to your IIS images web folder inside the {MT4 Data Folder} / MQL4 / Files. This way the files will actually be written to the IIS images web folder.
Creating symlinks is relatively easy, but if you don't know what they are and how to create them, you can look here: https://www.maketecheasier.com/create-symbolic-links-windows10/
Instead of symlinks you can also use Windows API calls via DLL imports to copy the file over, but that may be a bit of an overkill - a symlink should be sufficient.
Anyway, here is an EA you can use for the screengrab process:
//+------------------------------------------------------------------+ //| Snapshot.mq4 | //| Copyright 2018, Artur Zas | //| https://www.az-invest.eu | //+------------------------------------------------------------------+ #property copyright "Copyright 2018, Artur Zas" #property link "https://www.az-invest.eu" #property version "1.00" #property strict #include <stderror.mqh> #include <stdlib.mqh> input string InpImageWebfolder = "IIS image webfolder"; // IIS image webfolder symlink input int InpSaveInterval = 3600; // Save new image every x seconds input int InpWidth = 2048; // Width of image in pixels input int InpHeight = 1536; // Height of image in pixels //+------------------------------------------------------------------+ //| Expert initialization function | //+------------------------------------------------------------------+ int OnInit() { IsNewHour(true); return(INIT_SUCCEEDED); } //+------------------------------------------------------------------+ //| Expert deinitialization function | //+------------------------------------------------------------------+ void OnDeinit(const int reason) { } //+------------------------------------------------------------------+ //| Expert tick function | //+------------------------------------------------------------------+ void OnTick() { if(!IsNewHour(false)) return; string fileName = StringFormat("%s\\%s%d.png", InpImageWebfolder, _Symbol, _Period); if(!ChartScreenShot(0,fileName,InpWidth,InpHeight)) { string err = StringFormat("Error saving screenshot of %s(%d) chart - %s",_Symbol,_Period,ErrorDescription(GetLastError())); Alert(err); } else { PrintFormat("Saved screenshot to %s",fileName); } } //+------------------------------------------------------------------+ bool IsNewHour(bool reset) { static datetime last = 0; if(reset) { last = 0; return false; } if(last == 0) { last = TimeCurrent(); return true; } datetime current = TimeCurrent(); if(current - last > 3600) { last = current; return true; } return false; }

- 2017.02.12
- www.maketecheasier.com

- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Is there already a solution to automate these: