Grid Management by Array

MQL4 Experts Forex

Job finished

Execution time 5 days
Feedback from customer
Excellent work!! Very fast and good communication. Will use again!
Feedback from employee
good customer

Specification

I am looking to build a grid trade manager per my directions below.  The idea is from Proper Bot, which is available in the Codebase as a sample.  My desired code is a simpler version.

OK---since we are starting from scratch, here is the minimum.  I don't need the volume check, the hours check, or the MA check. It is very simple. I need a grid trade manager that uses an array as described below.  You may wonder why I need the 0 condition included.....I plan on expanding this project for additional fee later.  Today's fee is for part 1.   Part 1:  Get the trade grid to function, without an indicator, using a manual switch, with a close all in FIFO order for the 0 condition.

input int         BUYSELLSWITCH=1; // this is just a temporary manual switch. We will replace it later for the indicator. 1 means BUY, -1 means SELL. 0 means close all open orders per FIFO and monitor for new signal. When testing, this would be set to 1 and the EA would start Buying right away. When set to -1 it would start selling right away. When set to 0, it would close all open orders right away and then do nothing as it waits for the variable to change. To test the 0 condition, manually open several trades before starting the EA. 

input double      First_Lot= 0.01; // This is the first order that starts the process. 

input double      BrokerviewTP=600     // TP set in the order for the broker to see. These values are the same for all orders in the system, relative to each order. For safety. They will never be hit, unless my server goes down

input double      BrokerViewSL=1000     // SL set in the order for the broker to see.  These values are the same for all orders in the system, relative to each order. For safety. They will never be hit, unless my server goes down

input string      Grid_Map = "120/0.02/150/300 130/0.03/100/200 140/0.04/50/100 150/0.05/40/90 160/0.06/30/80";  //convert string to array. 

The four values for each item provide: points from previous order to add a new order, lot size of new order, TP for ALL open trades relative to the first lot (invisible to broker), SL for ALL open trades relative to the first lot (invisible to broker) 

This way, I have full control of the TP and SL points, relative to the First_Lot price, and they change according to the array each time a new order is added.  At every tick, the EA needs to check the BUYSELLSWITCH for a 0 condition to close all open trades in FIFO order.  When there are no open orders,  at every tick, the EA needs to check the BUYSELLSWITCH for a 1 or -1 condition to open the First_Lot. 


input int         BrokerviewTP=600;

input int         BrokerViewSL=1000;

input int         Slippage = 30;

input double      First_Lot= 0.01;

input double First_Lot_TP points=200     

input double First_Lot_SL points=400    

input string      Grid_Map = "120/0.02/150/300 130/0.03/100/200 140/0.04/50/100 150/0.05/40/90 160/0.06/30/80"; 

ALL close prices would be calculated relative to the original First_Lot_order_price, and readjusted according to the array.

Example:  Ea opens a Buy order of 0.01 Lots at 1.1800.  The order is set to TP at 300 points and SL at 1200 points (broker visible).

The Ea will set close_profit_price = First_Lot_order_price + 200.  Ea will set close_loss_price = First_Lot_order_price - 400

Then if price moves down 120 points, EA will open the next 0.02 order, and set close_profit_price = First_Lot_order_price + 150.  Ea will set close_loss_price = First_Lot_order_price - 300

Then if price moves down 130 points, EA will open the next 0.03 order, and set close_profit_price = First_Lot_order_price + 100.  Ea will set close_loss_price = First_Lot_order_price - 200

Then if price moves down 140 points, EA will open the next 0.04 order, and set close_profit_price = First_Lot_order_price + 50.  Ea will set close_loss_price = First_Lot_order_price - 100

Then if price moves down 150 points, EA will open the next 0.05 order, and set close_profit_price = First_Lot_order_price + 40.  Ea will set close_loss_price = First_Lot_order_price - 90

Then if price moves down 160 points, EA will open the next 0.06 order, and set close_profit_price = First_Lot_order_price + 30.  Ea will set close_loss_price = First_Lot_order_price - 80

These would all be invisible to the broker, because all he will ever see is the Take_Profit and Stop_Loss marks on each trade which will only get hit if EA is shut down due to power failure, or setting grid values higher than the broker visible SL and TP (which would be a user error, not an EA mistake)




How much will you charge me for this much work?

In part 2, which I will pay for separately, we will replace the BUYSELLSWITCH with an external indicator.  This way, I can use this EA to run from any kind of indicator I choose. 


Here is the sample code of this portion from the ProperBot (it is only 2 levels in the array, though...we need 4)


void init()

  {

   gi_Slippage=Slippage;

   gs_Symbol=_Symbol;


// Points to prices:

   gd_One_Pip_Ratio=MathPow(10,Digits);

   gd_TP = Take_Profit / gd_One_Pip_Ratio;

   gd_SL = Stop_Loss / gd_One_Pip_Ratio;

   gd_Stop_Level=MarketInfo(gs_Symbol,MODE_STOPLEVEL)/gd_One_Pip_Ratio;


// Strings to double:

   string sa_Grid_Levels[];

   double da_Grid_Level[2];                                        //Would you change this to a 4?????

   String_To_Array(Grid_Map,sa_Grid_Levels," ");

   int i_Grid_Level=ArraySize(sa_Grid_Levels);

   ArrayResize(gd_Distances_Map,i_Grid_Level);

   ArrayResize(gd_Lots_Map,i_Grid_Level);

   gi_Last_Index=i_Grid_Level-1;

   while(i_Grid_Level>0)

     {

      i_Grid_Level--;

      String_To_Double_Array(sa_Grid_Levels[i_Grid_Level],da_Grid_Level,"/");

      gd_Distances_Map[i_Grid_Level]=da_Grid_Level[0]/gd_One_Pip_Ratio;

      gd_Lots_Map[i_Grid_Level]=da_Grid_Level[1];

      Print(i_Grid_Level, ": ", gd_Distances_Map[i_Grid_Level], " / ", gd_Lots_Map[i_Grid_Level]);

     }


   gi_Connect_Wait*=1000;

   gi_Second_From=3600*Start_Hour+60*Start_Minute;

   gi_Second_To=3600*Finish_Hour+60*Finish_Minute;

  }

Responded

1
Developer 1
Rating
(620)
Projects
680
57%
Arbitration
25
16% / 60%
Overdue
228
34%
Free
2
Developer 2
Rating
(29)
Projects
49
22%
Arbitration
14
29% / 21%
Overdue
13
27%
Free
Similar orders
MT5 Professional Account Risk Manager & Multi-Symbol Trade Monitor Then keep the description technically equivalent, but rewrite the wording and organization so it doesn't look like a copy: > I am looking for an experienced MQL5/MT5 developer to create a professional account-level risk management and position monitoring Expert Advisor. The EA will not generate trading signals. Its primary purpose is to monitor and
Hi, I’m looking for an experienced MQL5/MT5 developer to build a complex AI-powered adaptive Expert Advisor for XAUUSD+ on Ultima Markets. I have a detailed 28-section technical specification, and the requirements are fixed. I’m looking for the complete implementation , not a simplified EA or a conventional indicator-based system. The project includes: Genuine AI/ML integration AI-based market regime classification
Trading bot ea 30+ USD
yoo i want to make a trading bot i have my strategy in videos and also the rules to if anyone can work it out for me i will be glad welcome your bid and it urget let connect here on mgl5 And if you know you can not do the project without getting paid first please don't bid thanks
MT5 EA make work on zone break and candle confirm. Hi i need one expert person who can make exact what i want. My EA logic very simple.... few hrs market high and low make line then candle body close above or low then candle confirmation then pullback then entry RR1:2 no trail nothing,,,,, the line high low create after few hrs of the day i wll tell you later,,,,then 1hrs no trade if break then no trade for the
المطلوب موشر لتداول الذهب مجرب وقوية يعطي اشاره قوية فقط مع وقف خساره ومختبر ومجرب في حال الموافقه علي لموشر بعد التجربه لمدة ٣ ايام يتم الشراء دايم مبلغ ٢٠٠ دولار
Masoudahg1 999999+ USD
Hello world, thank you for your helping and supporting for us from your for all everyone that investments or working in this programing and supporting seven/24 hours in daily and nightly for customers
Laily Mahmudy 100000+ USD
Thank you very much and of trying supporting and helping for us and my investfolio portfolio id is:"investfolio portfolio masoudahg1 id is":"7Zk0iVh7zuytHkQ9OJSzeY" &"35VmgKWofZxWowQ7O6CL8K" https://leylimahmudi46.atlassian.net is my Atlassian programing that when I working of this programs
Hi there I need someone who will create an ea then test it .. the ea should only place order on the bid price of it breakout in 1 point using invisible buy and invisible sell,, example if bid breakout in 1 point up automatically invisible buy active then invisible stop loss at where the ask price was same in sell If the bid breakout in 1 point down automatically invisible sell active then invisible stop loss where
I’m looking for an experienced MT5/MQL5 freelancer to help install and configure several existing EAs on IC Markets MT5 accounts using a Windows VPS. The work will include setting up the EAs on separate demo accounts and later running several together on one account with different risk settings. I also need help with MT5 backtesting and strategy optimisation, including comparing different risk levels and reviewing
Ea which is based on the price returning to the open or close of a 1-minute candle or zone of candles. panel on chart need too have buttons : trainding on/off close all close profit add buy stop add buy limit add sell stop add sell limit ( all to existing setups) calculating profit/loss for a single open setup and in total in account currency calculating profit/loss for a single open setup and in total in percentage

Project information

Budget
30 - 80 USD
Deadline
from 3 to 10 day(s)