trade history

trade historyThis is a simple example to demonstrate the usage of plotNewOpenTrades() and plotNewClosedTrades() that can be found in common_functions.mqh. MT4 will not automatically plot manual trades or trades resulting from pending orders into the chart, it only plots them when an EA sends a market order.However, we would like to see all trades in the chart and we don't want to drag them manually from the history into the chart, we would like this to happen automatically.#property indicator_chart_window#include <common_functions.mqh>int...

It's bollinger Brand MQL Code

//+------------------------------------------------------------------+//| Bollinger MA Price.mq4 |//| Paladin80 |//| forevex@mail.ru |//+------------------------------------------------------------------+#property copyright "Paladin80"#property link "forevex@mail.ru"#property indicator_chart_window#property indicator_buffers 3#property indicator_color1 LightSeaGreen#property indicator_color2 LightSeaGreen#property indicator_color3 LightSeaGreen//---- indicator parametersextern int BandsPeriod=20;extern int BandsShift=0;extern double BandsDeviations=2.0;extern...

day of the week

Here is code function which can be used say when ea needs to trade only during certain hours of the day and skip of certain day of the week :Code: bool ValidTime() { if (DayOfWeek()==1 && Hour()<=6) return(false); return(true); ...

Function to calculate total lots opened

Function to calculate total lots openedHere is the code fuction which will return the total number of lots which are currently running in open trades :Parameters: key is magic number, and type is the type of trades .Code:double gettotallot(int _key, int type){double _lot=0; for(int k=OrdersTotal(); k>=0; k--) { if (OrderSelect(k,SELECT_BY_POS,MODE_TRADES)&& OrderSymbol()==Symbol()&& OrderMagicNumber()==_key && OrderType()==type) _lot+=OrderLots(); } ...

CloseAllTrade Script

Here is a code which can be saved as a script file in the Scripts Folder.To execute the script, drage and drop the script on the current chart, this will close all open trades and also pending orders of all symbols. int start(){ double total; int cnt; while(OrdersTotal()>0) { // close opened orders first total = OrdersTotal(); for (cnt = total ; cnt >=0 ; cnt--) { if(OrderSelect(cnt,SELECT_BY_POS,MODE_TRADES)) { switch(OrderType()) { case OP_BUY :...

Code to take Screenshot of Chart and save it to local drive

Here is the Code that you can put in any EA to take a screenshot of the Chart and save it to disk, you can call this on any event like if there is any new trade taken, you can save the screenshot.the system function to take screenshot is:Code:WindowScreenShot(filename,size_x,size_y)Here is the example usage:Code:string filename= "Chart"+Symbol();WindowScreenShot(filename,570,428)The above will save the chart with name "ChartEURUSD". You can make the filename very dynamic so every time screenshot is taken, it would save it with different na...

Numeric Chart Period to Text String Format

Here is the code function that will return the chart period in the nicely formation text line.Example: (if EA is running on 1hour chart)chartperiod = periodToString(Period()) // will return 1 HourCode:string periodToString(int tf) { string tfString; switch (tf) { case 1: tfString = "1 Min"; break; case 5: tfString = "5 Min"; break; case 15: tfString = "15 Min"; break; case 30: tfString = "30 Min"; break; case 60: tfString = "1 Hour"; break; case 240: tfString...

Count All Open Trades

Following is a custom function which when called will return total of active trades for a particular magic number:Code:int CountAllTrades(int magic) { int c=0; for (int j=OrdersTotal()-1;j>=0;j--) { OrderSelect(j,SELECT_BY_POS,MODE_TRADES); if (OrderSymbol()==Symbol() && OrderMagicNumber()==magic) c++; } return(c...

Close All Function

This function will close All open trades for a particual MagicNumber of EA.Code:void CloseAll(){ int total = OrdersTotal(); for(int i=total-1;i>=0;i--) { OrderSelect(i, SELECT_BY_POS); int type = OrderType(); if (OrderSymbol()==Symbol() && (OrderMagicNumber() == MagicNumber)) { //-- Close open BUYs if (type == OP_BUY) OrderClose(OrderTicket(),OrderLots(),MarketInfo(OrderSymbol(),MODE_BID),Slippage,CornflowerBlue); //-- Close open SELLS if (type == OP_SELL) OrderClose(OrderTicket(),OrderLots(),MarketInfo(OrderSymbol(),MODE_ASK),Slippage,CornflowerBlue);...

the Broker is 4 digits or 5 digits pricing

Here is a code which you can use in an Expert Advisors to automatically adjust variables depending on if the Broker is 4 digits or 5 digits pricing. following code should be inside the int Init() functionCode:if(Digits==5 || Digits==3){ StopLoss= Stoploss * 10; // this adjusts Stoploss variable for 5digit brok...

EA Stochastic - Instant order

//+------------------------------------------------------------------+//|                                       Copyright © 2011, vgtechFX |//|                                          [url]http://www.vgtechFX.com[/url] |//+------------------------------------------------------------------+#property copyright "Copyright © 2011, vgtechFX"#property link...

EA nya dibikin OP nya manual

apakah ada yang bisa bantu coding,gimana kalo EA nya dibikin OP nya manual, setelah floating EA nya baru bekerjasupaya kita bisa mengatur arah nyaane sih belum pernah pakei EA ini mastertapi kalau mau digunakan sebagai penerus op manual kaya ea servantavg, mungkin bisa diotak atik bagian trigernya atau bagian yang menyebabkan EA buka order buy atau order sellNah pada bagian triger tsb di kasih boolian pada deklasrasiextern bool buy= false;extern bool sell=false;di triger opif(buy && ...........disini biasaya logika buynya ) ordersend(....OP_buy...);demikian...

Cara protect EA

1. Password protection code:Metode ini banyak di gunakan untuk memprotect EA.Cara kerjanya dengan memberikan password untuk melock ea kita. Code ini dapat digunakan:int start(){extern string Please_Enter_Password = "0";// your code here....int start(){if (password != "indo.mt5") //change to the password you give the user!{Alert ("Wrong password!");return (0); }// your code here....}Pada code diatas password yang digunakan adalah “indo.mt5″ dimana sudah di tuliskan di dalam MQL4 file dan kita hanya tinggal mengcompile program kita.2. Trial period...

Script Close order lengkap n muantap

##script Close order lengkap n muantap//+------------------------------------------------------------------+//| Close order lengkap n muantap.mq4 |//| Oprekan by Bambang Sugianto |//+------------------------------------------------------------------+#property copyright "Bambang Sugianto"#property show_inputs#include//+------------------------------------------------------------------+//| input parameters: |//+------------------------------------------------------------------+extern bool CloseAllSymbols = false;extern string Important = "Select...

ANEKA SCRIPT ORDER DENGAN RISK MANAGEMENT

SCRIPT ORDER DENGAN RISK MANAGEMENT::::BUY SCRIPT::::://+------------------------------------------------------------------+//| Buy with MM |//| Copyright © 2011, Rubianto |//| Rubi_Sniper |//+------------------------------------------------------------------+#property copyright "Copyright © Rubi_Sniper_2011"#property link "rubianto.md@gmail.com"//#property show_inputsextern double Lots = 1;extern bool UseMoneyMgmt = true;extern double RiskPercent = 5;extern bool UseStop = true;extern bool UseTakeProfit = true;extern double StopLoss = 30;extern...