MT4 Apps - Automate & Optimize your Forex Trading

My home-made bar replay for MT4

I made a home-made bar replay for MT4 as an alternative to the tradingview bar replay. You can change timeframes and use objects easily. It just uses vertical lines to block the future candles. Then it adjusts the vertical lines when you change zoom or time frames to keep the "future" bars hidden.
I am not a professional coder so this is not as robust as something like Soft4fx or Forex Tester. But for me it gets the job done and is very convenient. Maybe you will find some benefit from it.

Here are the steps to use it:
1) copy the text from the code block
2) go to MT4 terminal and open Meta Editor (click icon or press F4)
3) go to File -> New -> Expert Advisor
4) put in a title and click Next, Next, Finish
5) Delete all text from new file and paste in text from code block
6) go back to MT4
7) Bring up Navigator (Ctrl+N if it's not already up)
8) go to expert advisors section and find what you titled it
9) open up a chart of the symbol you want to test
10) add the EA to this chart
11) specify colors and start time in inputs then press OK
12) use "S" key on your keyboard to advance 1 bar of current time frame
13) use tool bar buttons to change zoom and time frames, do objects, etc.
14) don't turn on auto scroll. if you do by accident, press "S" to return to simulation time.
15) click "buy" and "sell" buttons (white text, top center) to generate entry, TP and SL lines to track your trade
16) to cancel or close a trade, press "close order" then click the white entry line
17) drag and drop TP/SL lines to modify RR
18) click "End" to delete all objects and remove simulation from chart
19) to change simulation time, click "End", then add the simulator EA to your chart with a new start time
20) When you click "End", your own objects will be deleted too, so make sure you are done with them
21) keep track of your own trade results manually
22) use Tools-> History center to download new data if you need it. the simulator won't work on time frames if you don't have historical data going back that far, but it will work on time frames that you have the data for. If you have data but its not appearing, you might also need to increase max bars in chart in Tools->Options->Charts.
23) don't look at status bar if you are moused over hidden candles, or to avoid this you can hide the status bar.

Here is the code block.
//+------------------------------------------------------------------+ //| Bar Replay V2.mq4 | //| Copyright 2020, MetaQuotes Software Corp. | //| | //+------------------------------------------------------------------+ #property copyright "Copyright 2020, MetaQuotes Software Corp." #property link "" #property version "1.00" #property strict #define VK_A 0x41 #define VK_S 0x53 #define VK_X 0x58 #define VK_Z 0x5A #define VK_V 0x56 #define VK_C 0x43 #define VK_W 0x57 #define VK_E 0x45 double balance; string balance_as_string; int filehandle; int trade_ticket = 1; string objectname; string entry_line_name; string tp_line_name; string sl_line_name; string one_R_line_name; double distance; double entry_price; double tp_price; double sl_price; double one_R; double TP_distance; double gain_in_R; string direction; bool balance_file_exist; double new_balance; double sl_distance; string trade_number; double risk; double reward; string RR_string; int is_tp_or_sl_line=0; int click_to_cancel=0; input color foreground_color = clrWhite; input color background_color = clrBlack; input color bear_candle_color = clrRed; input color bull_candle_color = clrSpringGreen; input color current_price_line_color = clrGray; input string start_time = "2020.10.27 12:00"; input int vertical_margin = 100; //+------------------------------------------------------------------+ //| Expert initialization function | //+------------------------------------------------------------------+ int OnInit() { Comment(""); ChartNavigate(0,CHART_BEGIN,0); BlankChart(); ChartSetInteger(0,CHART_SHIFT,true); ChartSetInteger(0,CHART_FOREGROUND,false); ChartSetInteger(0,CHART_AUTOSCROLL,false); ChartSetInteger(0,CHART_SCALEFIX,false); ChartSetInteger(0,CHART_SHOW_OBJECT_DESCR,true); if (ObjectFind(0,"First OnInit")<0){ CreateStorageHLine("First OnInit",1);} if (ObjectFind(0,"Simulation Time")<0){ CreateTestVLine("Simulation Time",StringToTime(start_time));} string vlinename; for (int i=0; i<=1000000; i++){ vlinename="VLine"+IntegerToString(i); ObjectDelete(vlinename); } HideBars(SimulationBarTime(),0); //HideBar(SimulationBarTime()); UnBlankChart(); LabelCreate("New Buy Button","Buy",0,38,foreground_color); LabelCreate("New Sell Button","Sell",0,41,foreground_color); LabelCreate("Cancel Order","Close Order",0,44,foreground_color); LabelCreate("Risk To Reward","RR",0,52,foreground_color); LabelCreate("End","End",0,35,foreground_color); ObjectMove(0,"First OnInit",0,0,0); //--- create timer EventSetTimer(60); return(INIT_SUCCEEDED); } //+------------------------------------------------------------------+ //| Expert deinitialization function | //+------------------------------------------------------------------+ void OnDeinit(const int reason) { //--- destroy timer EventKillTimer(); } //+------------------------------------------------------------------+ //| Expert tick function | //+------------------------------------------------------------------+ void OnTick() { //--- } //+------------------------------------------------------------------+ //| ChartEvent function | //+------------------------------------------------------------------+ void OnChartEvent(const int id, const long &lparam, const double &dparam, const string &sparam) { if (id==CHARTEVENT_CHART_CHANGE){ int chartscale = ChartGetInteger(0,CHART_SCALE,0); int lastchartscale = ObjectGetDouble(0,"Last Chart Scale",OBJPROP_PRICE,0); if (chartscale!=lastchartscale){ int chartscale = ChartGetInteger(0,CHART_SCALE,0); ObjectMove(0,"Last Chart Scale",0,0,chartscale); OnInit(); }} if (id==CHARTEVENT_KEYDOWN){ if (lparam==VK_S){ IncreaseSimulationTime(); UnHideBar(SimulationPosition()); NavigateToSimulationPosition(); CreateHLine(0,"Current Price",Close[SimulationPosition()+1],current_price_line_color,1,0,true,false,false,"price"); SetChartMinMax(); }} if(id==CHARTEVENT_OBJECT_CLICK) { if(sparam=="New Sell Button") { distance = iATR(_Symbol,_Period,20,SimulationPosition()+1)/2; objectname = "Trade # "+IntegerToString(trade_ticket); CreateHLine(0,objectname,Close[SimulationPosition()+1],foreground_color,2,5,false,true,true,"Sell"); objectname = "TP for Trade # "+IntegerToString(trade_ticket); CreateHLine(0,objectname,Close[SimulationPosition()+1]-distance*2,clrAqua,2,5,false,true,true,"TP"); objectname = "SL for Trade # "+IntegerToString(trade_ticket); CreateHLine(0,objectname,Close[SimulationPosition()+1]+distance,clrRed,2,5,false,true,true,"SL"); trade_ticket+=1; } } if(id==CHARTEVENT_OBJECT_CLICK) { if(sparam=="New Buy Button") { distance = iATR(_Symbol,_Period,20,SimulationPosition()+1)/2; objectname = "Trade # "+IntegerToString(trade_ticket); CreateHLine(0,objectname,Close[SimulationPosition()+1],foreground_color,2,5,false,true,true,"Buy"); objectname = "TP for Trade # "+IntegerToString(trade_ticket); CreateHLine(0,objectname,Close[SimulationPosition()+1]+distance*2,clrAqua,2,5,false,true,true,"TP"); objectname = "SL for Trade # "+IntegerToString(trade_ticket); CreateHLine(0,objectname,Close[SimulationPosition()+1]-distance,clrRed,2,5,false,true,true,"SL"); trade_ticket+=1; } } if(id==CHARTEVENT_OBJECT_DRAG) { if(StringFind(sparam,"TP",0)==0) { is_tp_or_sl_line=1; } if(StringFind(sparam,"SL",0)==0) { is_tp_or_sl_line=1; } Comment(is_tp_or_sl_line); if(is_tp_or_sl_line==1) { trade_number = StringSubstr(sparam,7,9); entry_line_name = trade_number; tp_line_name = "TP for "+entry_line_name; sl_line_name = "SL for "+entry_line_name; entry_price = ObjectGetDouble(0,entry_line_name,OBJPROP_PRICE,0); tp_price = ObjectGetDouble(0,tp_line_name,OBJPROP_PRICE,0); sl_price = ObjectGetDouble(0,sl_line_name,OBJPROP_PRICE,0); sl_distance = MathAbs(entry_price-sl_price); TP_distance = MathAbs(entry_price-tp_price); reward = TP_distance/sl_distance; RR_string = "RR = 1 : "+DoubleToString(reward,2); ObjectSetString(0,"Risk To Reward",OBJPROP_TEXT,RR_string); is_tp_or_sl_line=0; } } if(id==CHARTEVENT_OBJECT_CLICK) { if(sparam=="Cancel Order") { click_to_cancel=1; Comment("please click the entry line of the order you wish to cancel."); } } if(id==CHARTEVENT_OBJECT_CLICK) { if(sparam!="Cancel Order") { if(click_to_cancel==1) { if(ObjectGetInteger(0,sparam,OBJPROP_TYPE,0)==OBJ_HLINE) { entry_line_name = sparam; tp_line_name = "TP for "+sparam; sl_line_name = "SL for "+sparam; ObjectDelete(0,entry_line_name); ObjectDelete(0,tp_line_name); ObjectDelete(0,sl_line_name); click_to_cancel=0; ObjectSetString(0,"Risk To Reward",OBJPROP_TEXT,"RR"); } } } } if (id==CHARTEVENT_OBJECT_CLICK){ if (sparam=="End"){ ObjectsDeleteAll(0,-1,-1); ExpertRemove(); }} } //+------------------------------------------------------------------+ void CreateStorageHLine(string name, double value){ ObjectDelete(name); ObjectCreate(0,name,OBJ_HLINE,0,0,value); ObjectSetInteger(0,name,OBJPROP_SELECTED,false); ObjectSetInteger(0,name,OBJPROP_SELECTABLE,false); ObjectSetInteger(0,name,OBJPROP_COLOR,clrNONE); ObjectSetInteger(0,name,OBJPROP_BACK,true); ObjectSetInteger(0,name,OBJPROP_ZORDER,0); } void CreateTestHLine(string name, double value){ ObjectDelete(name); ObjectCreate(0,name,OBJ_HLINE,0,0,value); ObjectSetInteger(0,name,OBJPROP_SELECTED,false); ObjectSetInteger(0,name,OBJPROP_SELECTABLE,false); ObjectSetInteger(0,name,OBJPROP_COLOR,clrWhite); ObjectSetInteger(0,name,OBJPROP_BACK,true); ObjectSetInteger(0,name,OBJPROP_ZORDER,0); } bool IsFirstOnInit(){ bool bbb=false; if (ObjectGetDouble(0,"First OnInit",OBJPROP_PRICE,0)==1){return true;} return bbb; } void CreateTestVLine(string name, datetime timevalue){ ObjectDelete(name); ObjectCreate(0,name,OBJ_VLINE,0,timevalue,0); ObjectSetInteger(0,name,OBJPROP_SELECTED,false); ObjectSetInteger(0,name,OBJPROP_SELECTABLE,false); ObjectSetInteger(0,name,OBJPROP_COLOR,clrNONE); ObjectSetInteger(0,name,OBJPROP_BACK,false); ObjectSetInteger(0,name,OBJPROP_ZORDER,3); } datetime SimulationTime(){ return ObjectGetInteger(0,"Simulation Time",OBJPROP_TIME,0); } int SimulationPosition(){ return iBarShift(_Symbol,_Period,SimulationTime(),false); } datetime SimulationBarTime(){ return Time[SimulationPosition()]; } void IncreaseSimulationTime(){ ObjectMove(0,"Simulation Time",0,Time[SimulationPosition()-1],0); } void NavigateToSimulationPosition(){ ChartNavigate(0,CHART_END,-1*SimulationPosition()+15); } void NotifyNotEnoughHistoricalData(){ BlankChart(); Comment("Sorry, but there is not enough historical data to load this time frame."+"\n"+ "Please load more historical data or use a higher time frame. Thank you :)");} void UnHideBar(int barindex){ ObjectDelete(0,"VLine"+IntegerToString(barindex+1)); } void BlankChart(){ ChartSetInteger(0,CHART_COLOR_FOREGROUND,clrNONE); ChartSetInteger(0,CHART_COLOR_CANDLE_BEAR,clrNONE); ChartSetInteger(0,CHART_COLOR_CANDLE_BULL,clrNONE); ChartSetInteger(0,CHART_COLOR_CHART_DOWN,clrNONE); ChartSetInteger(0,CHART_COLOR_CHART_UP,clrNONE); ChartSetInteger(0,CHART_COLOR_CHART_LINE,clrNONE); ChartSetInteger(0,CHART_COLOR_GRID,clrNONE); ChartSetInteger(0,CHART_COLOR_ASK,clrNONE); ChartSetInteger(0,CHART_COLOR_BID,clrNONE);} void UnBlankChart(){ ChartSetInteger(0,CHART_COLOR_FOREGROUND,foreground_color); ChartSetInteger(0,CHART_COLOR_CANDLE_BEAR,bear_candle_color); ChartSetInteger(0,CHART_COLOR_CANDLE_BULL,bull_candle_color); ChartSetInteger(0,CHART_COLOR_BACKGROUND,background_color); ChartSetInteger(0,CHART_COLOR_CHART_DOWN,foreground_color); ChartSetInteger(0,CHART_COLOR_CHART_UP,foreground_color); ChartSetInteger(0,CHART_COLOR_CHART_LINE,foreground_color); ChartSetInteger(0,CHART_COLOR_GRID,clrNONE); ChartSetInteger(0,CHART_COLOR_ASK,clrNONE); ChartSetInteger(0,CHART_COLOR_BID,clrNONE);} void HideBars(datetime starttime, int shift){ int startbarindex = iBarShift(_Symbol,_Period,starttime,false); ChartNavigate(0,CHART_BEGIN,0); if (Time[WindowFirstVisibleBar()]>SimulationTime()){NotifyNotEnoughHistoricalData();} if (Time[WindowFirstVisibleBar()]=0; i--){ vlinename="VLine"+IntegerToString(i); ObjectCreate(0,vlinename,OBJ_VLINE,0,Time[i],0); ObjectSetInteger(0,vlinename,OBJPROP_COLOR,background_color); ObjectSetInteger(0,vlinename,OBJPROP_BACK,false); ObjectSetInteger(0,vlinename,OBJPROP_WIDTH,vlinewidth); ObjectSetInteger(0,vlinename,OBJPROP_ZORDER,10); ObjectSetInteger(0,vlinename,OBJPROP_FILL,true); ObjectSetInteger(0,vlinename,OBJPROP_STYLE,STYLE_SOLID); ObjectSetInteger(0,vlinename,OBJPROP_SELECTED,false); ObjectSetInteger(0,vlinename,OBJPROP_SELECTABLE,false); } NavigateToSimulationPosition(); SetChartMinMax();} }//end of HideBars function void SetChartMinMax(){ int firstbar = WindowFirstVisibleBar(); int lastbar = SimulationPosition(); int lastbarwhenscrolled = WindowFirstVisibleBar()-WindowBarsPerChart(); if (lastbarwhenscrolled>lastbar){lastbar=lastbarwhenscrolled;} double highest = High[iHighest(_Symbol,_Period,MODE_HIGH,firstbar-lastbar,lastbar)]; double lowest = Low[iLowest(_Symbol,_Period,MODE_LOW,firstbar-lastbar,lastbar)]; ChartSetInteger(0,CHART_SCALEFIX,true); ChartSetDouble(0,CHART_FIXED_MAX,highest+vertical_margin*_Point); ChartSetDouble(0,CHART_FIXED_MIN,lowest-vertical_margin*_Point); } void LabelCreate(string labelname, string labeltext, int row, int column, color labelcolor){ int ylocation = row*18; int xlocation = column*10; ObjectCreate(0,labelname,OBJ_LABEL,0,0,0); ObjectSetString(0,labelname,OBJPROP_TEXT,labeltext); ObjectSetInteger(0,labelname,OBJPROP_COLOR,labelcolor); ObjectSetInteger(0,labelname,OBJPROP_FONTSIZE,10); ObjectSetInteger(0,labelname,OBJPROP_ZORDER,10); ObjectSetInteger(0,labelname,OBJPROP_BACK,false); ObjectSetInteger(0,labelname,OBJPROP_CORNER,CORNER_LEFT_UPPER); ObjectSetInteger(0,labelname,OBJPROP_ANCHOR,ANCHOR_LEFT_UPPER); ObjectSetInteger(0,labelname,OBJPROP_XDISTANCE,xlocation); ObjectSetInteger(0,labelname,OBJPROP_YDISTANCE,ylocation);} double GetHLinePrice(string name){ return ObjectGetDouble(0,name,OBJPROP_PRICE,0); } void CreateHLine(int chartid, string objectnamey, double objectprice, color linecolor, int width, int zorder, bool back, bool selected, bool selectable, string descriptionn) { ObjectDelete(chartid,objectnamey); ObjectCreate(chartid,objectnamey,OBJ_HLINE,0,0,objectprice); ObjectSetString(chartid,objectnamey,OBJPROP_TEXT,objectprice); ObjectSetInteger(chartid,objectnamey,OBJPROP_COLOR,linecolor); ObjectSetInteger(chartid,objectnamey,OBJPROP_WIDTH,width); ObjectSetInteger(chartid,objectnamey,OBJPROP_ZORDER,zorder); ObjectSetInteger(chartid,objectnamey,OBJPROP_BACK,back); ObjectSetInteger(chartid,objectnamey,OBJPROP_SELECTED,selected); ObjectSetInteger(chartid,objectnamey,OBJPROP_SELECTABLE,selectable); ObjectSetString(0,objectnamey,OBJPROP_TEXT,descriptionn); } //end of code 
submitted by Learning_2 to Forex [link] [comments]

Auto-trading fun with Bollinger bands [Novice level].

Whilst we have a fair few 'novice' posts about TA and Global Macro (aka "Fundamentals"), there aren't too many involving auto-trading. Seeing as I'm in the middle of teaching myself MQL4, I thought I'd throw this out there as discussion prompter.
By "novice", I mean someone who has moved beyond complete beginner ("what's a FOMC and a NFP?") but still not deploying robust and market ready strategies ("how does market structure affect news event response?"), so constructive criticism, informed commentary or taking the ideas and developing them further are very much the point of sharing in the first place. It's not meant to be a showcase of code, because the code is a mess!
This post got me thinking about how relatively trivial it would be to implement a Bollinger Band mean reversion autotrader.
Project Goals
My interest in the project was as a way to begin development of a skeleton EA that would use a custom indicator to implement trade signals. The point of this would be to allow for faster prototyping of visually based autotrading before taking it to the testing environment. The key advantage of this is that you can see on your charts which entries are being missed, something that is much more laborious to do via visual mode in the strategy tester.
Concept Development
So to begin the project, I sketched out the concept.
One way to trade Bollinger Bands is to trade the reversion to the mean. Intuitively, we expect that wider deviations from the mean will result in more reliable reversions to the mean. To explore this we could enter when price breaches the second SD band and then returns back inside it.
Here's the default Bollinger Band on default settings in MT4, demonstrating this sort of behaviour:
I want to use the indicator, and not the EA, to generate trade signals, as this is the point of the project for me. Because I'm lazy and grew up coding in basements, I opt to fiddle with the default indicator code rather than build up from scratch.
My first goal is to add two things.
Firstly, I want to add another layer of bands, because I saw a set up like that a while ago and liked it. (This is not a very good reason, and I think it costs me down the track).
Secondly, I want to add in a way to visually indicate the trade signals before we pass them to the EA.
Adding another set of bands is just a copy and paste of the existing bands. My learning point here is that I need to adjust the amount of buffers to match the number of bands I want. This comes into play for adding the trade signal arrows, as they need to go in the same sort of structure as the second lot of bands.
[I know from reading about the project goals in advance that EAs access custom indicators via iCustom(). This function can only receive the contents of one of the first 8 indicator buffers. Thus the idea will be that the buffer that marks out the trade entries on the indicator will later be used by the EA to mark out where entries should be. It's possible this is not the best way for EAs to access custom indicators , so input from more experienced coders is welcome!]
#property indicator_chart_window #property indicator_buffers 8 // <---- have to set this to match your copy and pasted buffer amount #property indicator_color1 LightSeaGreen #property indicator_color2 LightSeaGreen #property indicator_color3 LightSeaGreen // hack in (make 'em colourful. Turns out I didn't understand how the numbering worked, and indictator_color4 is never visualised) #property indicator_color4 clrWhite #property indicator_color5 clrWhite #property indicator_color6 clrRed #property indicator_color7 clrGreen #property indicator_color8 clrRed //--- indicator parameters input int InpBandsPeriod=50; // Bands Period input int InpBandsShift=0; // Bands Shift input double InpBandsInnerDeviations=1.0; // Add in for our other Band input double InpBandsOuterDeviations=2.0; // Bands Deviations //--- buffers double ExtMovingBuffer[]; double ExtUpperBuffer[]; double ExtLowerBuffer[]; double ExtStdDevBuffer[]; // hack in buffers (these buffers will store our trade signals) double SellSignalBuffer[]; double BuySignalBuffer[]; // these buffers will hold the additional bands. apologies for the naming, I didn't originally intend to share this double ExtUpperUpperBuffer[]; double ExtLowerLowerBuffer[]; //+------------------------------------------------------------------+ //| Custom indicator initialization function | //+------------------------------------------------------------------+ int OnInit(void) { //--- 1 additional buffer used for counting. IndicatorBuffers(8); // don't forget to adjust this to account for the new buffers IndicatorDigits(Digits); //--- middle line SetIndexStyle(0,DRAW_LINE); SetIndexBuffer(0,ExtMovingBuffer); SetIndexShift(0,InpBandsShift); SetIndexLabel(0,"Bands SMA"); //--- upper band SetIndexStyle(1,DRAW_LINE); SetIndexBuffer(1,ExtUpperBuffer); SetIndexShift(1,InpBandsShift); SetIndexLabel(1,"Bands Upper"); //--- lower band SetIndexStyle(2,DRAW_LINE); SetIndexBuffer(2,ExtLowerBuffer); SetIndexShift(2,InpBandsShift); SetIndexLabel(2,"Bands Lower"); SetIndexBuffer(3,ExtStdDevBuffer); //--- Copy and paste from above, and just change the number! Upper outer band is INDEX 4 SetIndexStyle(4,DRAW_LINE); SetIndexBuffer(4,ExtUpperUpperBuffer); SetIndexShift(4,InpBandsShift); SetIndexLabel(4,"Bands Outer Upper"); //--- Copy& paste, lower outer band is INDEX 5 SetIndexStyle(5,DRAW_LINE); SetIndexBuffer(5,ExtLowerLowerBuffer); SetIndexShift(5,InpBandsShift); SetIndexLabel(5,"Bands Outer Lower"); //--- remind myself which is which so I don't forget later: sell signal is INDEX 6!!!! SetIndexStyle(6,DRAW_ARROW); SetIndexArrow(6,218); SetIndexBuffer(6,SellSignalBuffer); SetIndexShift(6,InpBandsShift); SetIndexLabel(6,"Sell Signal"); //--- buy signal is INDEX 7 !!! SetIndexStyle(7,DRAW_ARROW); SetIndexArrow(7,217); SetIndexBuffer(7,BuySignalBuffer); SetIndexShift(7,InpBandsShift); SetIndexLabel(7,"Buy Signal"); //--- check for input parameter if(InpBandsPeriod<=0) { Print("Wrong input parameter Bands Period=",InpBandsPeriod); return(INIT_FAILED); } //--- SetIndexDrawBegin(0,InpBandsPeriod+InpBandsShift); SetIndexDrawBegin(1,InpBandsPeriod+InpBandsShift); SetIndexDrawBegin(2,InpBandsPeriod+InpBandsShift); // hack in our additional buffers, so they also start at the corect point SetIndexDrawBegin(4,InpBandsPeriod+InpBandsShift); SetIndexDrawBegin(5,InpBandsPeriod+InpBandsShift); SetIndexDrawBegin(6,InpBandsPeriod+InpBandsShift); SetIndexDrawBegin(7,InpBandsPeriod+InpBandsShift); //--- initialization done return(INIT_SUCCEEDED); } //+------------------------------------------------------------------+ //| Bollinger Bands | //+------------------------------------------------------------------+ // all of this code is from the default indicator 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[]) { int i,pos; //--- if(rates_total<=InpBandsPeriod || InpBandsPeriod<=0) { return(0); } //--- counting from 0 to rates_total ArraySetAsSeries(ExtMovingBuffer,false); ArraySetAsSeries(ExtUpperBuffer,false); ArraySetAsSeries(ExtLowerBuffer,false); ArraySetAsSeries(ExtStdDevBuffer,false); // hack in to make sure our custom buffers run in the same direction ArraySetAsSeries(SellSignalBuffer,false); ArraySetAsSeries(ExtUpperUpperBuffer,false); ArraySetAsSeries(ExtLowerLowerBuffer,false); ArraySetAsSeries(BuySignalBuffer,false); ArraySetAsSeries(close,false); ArraySetAsSeries(high,false); ArraySetAsSeries(low,false); //--- initial zero if(prev_calculated<1) { for(i=0; i1) pos=prev_calculated-1; else pos=0; //--- main cycle for(i=pos; i After a bit of tweaking typos, the indicator now displays two sets of bands, one at 1x SD and one at 2xSD from the mean (moving average). It also has two buffers that will use the DRAW_ARROW style to mark out potential trades.
Adding trade logic
I still can't decide if it's better to isolate the logic code in the Custom Indicator or the EA, in the long run. There seem to be performative, stylistic and redundancy issues, but for the moment the project is to put the logic in the Indicator, so that's what I did.
The fastest way to prototype this idea seems to be identifying when price closes outside of the far band.
This is trivial to achieve. We compare the close to the two outer bands, and if it's outside them, then we set the relevant trade signal buffer.
 double tempclose = close[i]; if(tempclose>(ExtUpperUpperBuffer[i]+10*Point)) { SellSignalBuffer[i] = high[i]+(20* Point); } else { SellSignalBuffer[i] = 0; } if(tempclose<(ExtLowerLowerBuffer[i]-10*Point)) { BuySignalBuffer[i] = low[i]-(20*Point); } else { BuySignalBuffer[i]=0; } } 
It works!
Green arrows successfully mark out possible sell entries where price closes above the top band, and red arrows mark out possible buy entries when price closes below the lower band.
The logic can be a lot more complicated than this obviously, but the point of my project is to develop the iCustom technique, rather than make a good autotrader.
Now it's time to switch to the EA.
part two to follow
submitted by alotmorealots to Forex [link] [comments]

( (Download) Local Trade Copier For Metatrader 4 (Google Review)

^ (Get) Local Trade Copier For Metatrader 4 (Discount Code)

Click Here To Get More Info About Local Trade Copier For Metatrader 4 Forex...MT4...Trade...Copier,Order...Duplicator.MetaTrade4...price...alerts/,...... Trader'
Forex...Remote...Copier...-...FX...Copier...Solution Our...MetaTrader...(MT4) Trader'

Click Here To Get More Info About Local Trade Copier For Metatrader 4

( (Purchase) Local Trade Copier For Metatrader 4 (Coupon)
submitted by kindbroker777la to pwmood72 [link] [comments]

Dragon EA Most Profitable Forex EA - YouTube How to build an Expert Advisor without coding - YouTube Best FOREX ROBOT Ever 2019. $100 to $50,000 in a month ... Local Trade Copier for Metatrader 4 by EA Coder Best EA forex 2015 $30 to $90000000 in one month Rimantas Petrauskas - YouTube

Today I review FX Source Code a new Forex software by an unknown developer. I am far from impressed. The sales page consists of a YouTube video and a couple account statements. The proof that the FX Source Code is relying on is a supposed two week span where the system earned nearly $15,000. EA Coder programs automated forex trading software for the MetaTrader platform.'s MT4 EAs Apps include Trendline Trader, Stealth EA, Candle Range Trader etc. for online currency trading. The forex tools from EACoder are supposed to do some of the jobs for you, copy trades and deliver trading signals for you. Top 30 Ranking – Best Forex EA's – Expert Advisors – FX Robots. Dear fellow Forex trader, View the Best Forex EA’s, reviews and proven results and select the best FX Expert Advisors for Metatrader 4 (MT4) or Metatrader 5 (MT5) trading platforms for your needs.. This is our Top 30 Ranking of the Best Forex Robots, which will earn you lots of money! Rimantas Petrauskas is the founder of and he offers a variety of Forex trading tools for the MetaTrader 4.. These MT4 Apps can automate your Forex trading and do many tasks for you like duplicate trades between multiple MT4 accounts, open timed orders, calculate lot size automatically, open orders on breakouts, close trades at the specified time, or even help you sell trading ... EA Coder is a company that has been developing tools to integrate artificial intelligence with forex trading. One of their products, Hedge EA is aimed at facilitating hedging, built as per the requirements and recommendations of traders that practice hedging. Hedge Forex EA Offering. Hedge EA is suitable for traders who have good knowledge of hedging and practice it regularly, providing them ... EA Coders LLC specializes in coding EA's, indicators, and scripts for the Metatrader platforms. We also provide other coding and online services. Contact us today for a free quote. FX Market Code – free system by Russ Horn. System comes with TradeOnix (our review of Tradeonix / Tradeonix official website).The indicator inside of the price section of the chart is called the MarCo indicator. The one below the price is called the MarCo-OsMA. Hire Forex EA developer today. Order MQL4 Coding Services. Forex Trading Tools for MT4. Cannot stay up late 24 hours a day at your computer screen trading Forex? Automate and optimize your Forex trading with our MT4 Apps for trade copying, trendline breakouts, hedge trading, lot size calculation, partial closes, timed trade exits, selling trading signals, etc. Don't be glued to your computer ... EA Coder creates Forex Software for Metatrader 4 plaftorm. We offer custom MT4 programming, website programming, Forex Signal Websites, Forex Trading Signals and more.

[index] [11960] [28077] [23492] [21505] [27776] [8534] [7473] [14246] [28654] [21169]

Dragon EA Most Profitable Forex EA - YouTube

forex ea generator crack forex ea generator 6 forex ea generator professional v4.1 forex ea generator 5 crack forex ea generator online forex ea generator 4 forex ea generator 5.1 crack forex ea hedge Rimantas Petrauskas is one of the most well-known programmers among Forex traders. Having more than 18 years of programming experience he created two of the ... Local Trade Copier for Metatrader 4 by EA Coder Rimantas Petrauskas. Loading... Unsubscribe from Rimantas Petrauskas? Cancel Unsubscribe. Working... Subscribe Subscribed Unsubscribe 83. Loading ... #Mt4 #AutoTradingSignalSoftware #Binary #IQ option #best ea free download I hope you video help you in your trading... Please Subscribe Easy way to build your own Expert Advisor without knowing how to code; in a few simple steps you will get your EA done. Can use own indicators, or any indica... Download Dragon Expert Advisor: You are free to run it in demo account and... Register for the full course here: Follow me on Instagram: Join our Discord room here ht...