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
(28)
Projects
47
23%
Arbitration
13
31% / 15%
Overdue
12
26%
Free
Similar orders
I installed the E.A. into the Experts folder in MT4. When I double click on it nothing happens. When I right click and "attach to chart" nothing happens. The E.A. is not grayed out, it simply will not attach. Any help would be greatly Appreciated
Lilit ordrer 50+ USD
l doa language that allows creating trading robots and technical indicators. i can do any writing and translation so dont worry i can do what you want ke to do
hi hi there i have an strategy on tradingview and i want to automate it like metatrader EA so i want the strategy to open and close trade automaticlly on tradingview
We are looking for an experienced Expert Advisor Developer who can build a customized MT5 Expert Advisor for us. The Expert Advisor would use two built-in indicators as entry/exit signals and our own risk management strategy with customizable inputs. The goal is to create a reliable and efficient trading tool that can automate our trading process on the MT5 platform. Skills required: - Strong understanding of
The wiper 35 - 48 USD
a ll traders want to find market behavior patterns, which could help identify favorable moments for performing trading operations. They also want to eliminate randomness and influence of external factors, such as rumors, news releases, fatigue, and so on. Traders monitor charts and may formulate some formal rules, which enable objective analysis of price or tick charts. Technical indicators can facilitate such
I need EA that works on MT5 to be able to do the following: - Can recognize Support/Resistance area - Can recognize VWAP direction. - Can recognize RSI. - Can recognize Double Top/bottom, Bullish/Bearish hammer candle, Bullish/bearish engulfing candle. - Ability to set Stoploss below/above support/resistance, but risk must be fixed at a certain price. - Stoploss
I want a program that will help calculate and enter the market on full margin for me. I just need to put in the price for entry, Stop loss and TP then it will calculate the lot sizes for entering the trade on full margin on Mt5
I am seeking a highly skilled and experienced developer to assist with an important project. I need a development of an automated trading bot for NinjaTrader, utilizing a 4 SMA (Simple Moving Average) crossing strategy, with additional custom diversions for trade entries. The bot needs to be based on a strategy involving the crossing of four different SMAs. The exact periods for these SMAs and the conditions for
So i have copier EA. The idea is the EA will triggered through manual OP by user via mobile or whatever platform. Let's say 0.01 lot to trigger it. After the EA takes master's position, the EA will be standby mode. If the master take more OP, the EA still not take the master's position (OP) until the user input manually once again via mobile for another 0.01 lot. Since this is a MT4 EA, Whenever user want to close
preciso de um robô com duas médias móveis, uma exponencial high e uma exponencial low. preciso também ter a opção de utilizar e todos os tempos gráficos e alterar os parâmetros das médias. entrada de compra será feita quando um candle de alta romper e fechar a cima da média high e fechará a posição quando um candle de baixa romper e fechar a baixo da média low. a venda será feita quando o candle de baixa romper e

Project information

Budget
30 - 80 USD
For the developer
27 - 72 USD
Deadline
from 3 to 10 day(s)