A simple expert advisor scanning multiple codes

MQL5 Experts C++

Tâche terminée

Temps d'exécution 4 jours
Commentaires du client
Very helpful
Commentaires de l'employé
Thanks! Nice customer.. hoping that we will work together again:)

Spécifications

I am very novice in programming a robot and I would like to develop the following EA. Overall the robot is looping continuously over a large number of symbols performing a few calculations on those symbols prices and deciding if it wants to buy or sell. I want no two open positions for the same symbol and also no position exchange (no positions should be closed to open new ones). For each open position of a symbol, the robot will need to find the buying price for that position and the day the position was opened as this is important information for determining the selling point.


I am not sure if one script can loop over several symbols (some users suggest that each tick function can only be employed on a single symbol). I am open to your suggestions (possibly copying pasting the code multiple times to scan various symbols or similar solution. I will need a couple of market days to test the code myself. See below for full annotation:



void OnTick()

  {

\\ Define a list of codes (approximately 500 codes in reality) to be checked. I have unsuccessfully tried defining an array and looping through those symbols. Possibly this is not the right solution (maybe you need to run OnTicks for each code separately. )

string symbol_array[]={"XOM","AAL","ABNB"};

int number_of_symbols=ArraySize(symbol_array);

Print("Total number of symbols is =",number_of_symbols);


for(int symbol_position=1;symbol_position<=number_of_symbols;symbol_position++)

{string stockname=symbol_array[symbol_position];

Print("Current symbol is =",stockname); 


\\ Do some simple calculations on the selected symbol, i.e. take its few last closing prices - No changes needed

double   Current_close = iClose(stockname,PERIOD_M1,0);

double   Close_minus1 = iClose(stockname,PERIOD_M1,1);

double   Close_minus2 = iClose(stockname,PERIOD_M1,2);

double   Close_minus3 = iClose(stockname,PERIOD_M1,3);

double   High_minus_1day = iHigh(stockname,PERIOD_D1,1);

double   High_minus_2day = iHigh(stockname,PERIOD_D1,2);

double   High_minus_3day = iHigh(stockname,PERIOD_D1,3);

double   High_minus_4day = iHigh(stockname,PERIOD_D1,4);

double   High_minus_5day = iHigh(stockname,PERIOD_D1,5);

double   High_minus_6day = iHigh(stockname,PERIOD_D1,6);

double   High_minus_7day = iHigh(stockname,PERIOD_D1,7);

double   High_minus_8day = iHigh(stockname,PERIOD_D1,8);


\\ Calculate a simple index of the trend pattern and also some local percentage changes and derivatives.  - No changes needed

double   Trending_pattern = (High_minus_4day+High_minus_3day+High_minus_2day+High_minus_1day) - (High_minus_8day+High_minus_7day+High_minus_6day+High_minus_5day);

double   Percentage_move3 = (Current_close-Close_minus3)/Close_minus3;

double   Percentage_move2 = (Current_close-Close_minus2)/Close_minus2;

double   Percentage_move1 = (Current_close-Close_minus1)/Close_minus1;

double   Local_derivative = Close_minus2/2 - 2*Close_minus1 +3*Current_close/2;


\\ Generate a buy signal IF Trending_pattern>0 && Local_derivative>0.05 && NO orders are pending for this code and NO positions are open for this code.

I do not want to exchange (close positions to open new ones) any currently open position. I do not know how to implement the 'NO orders should be pending and the 'NO open positions should exist for this code' parts. Please help me with this.

//buy signal

if ( Trending_pattern>0 && Local_derivative>0.05 && OrdersTotal()==0 )

{

   MqlTradeRequest request={0};

   MqlTradeResult  result={0};

//--- parameters of request

   request.action   =TRADE_ACTION_DEAL;                     // type of trade operation

   request.symbol   =stockname;                              // symbol

   request.volume   =1;                                   // volume of 0.1 lot

   request.type     =ORDER_TYPE_BUY;                        // order type

   request.deviation=5;    


OrderSend(request,result);

}


\\ Generate a SELL signal IF 'the current selling price Current_close of an open position for the current code is 1.1 times the price I have bought it in the past' OR 'the position for this code was opened more than 3 days ago'.

I do not know how to implement either of these 2 conditions. Please help me with that.

//sell signal

if (Current_close >1.1*Price_paid_for_position)

{

   MqlTradeRequest request={0};

   MqlTradeResult  result={0};

//--- parameters of request

   request.action   =TRADE_ACTION_DEAL;                     // type of trade operation

   request.symbol   =stockname;                              // symbol

   request.volume   =0.1;                                   // volume of 0.1 lot

   request.type     =ORDER_TYPE_SELL;                        // order type

   request.deviation=5;   

   

OrderSend(request,result);

}


\\ The above calculation has to loop over all codes included in the symbol_array string one by one for an indefinite amount of time.



Répondu

1
Développeur 1
Évaluation
(57)
Projets
72
22%
Arbitrage
13
46% / 15%
En retard
5
7%
Gratuit
2
Développeur 2
Évaluation
(58)
Projets
66
8%
Arbitrage
39
26% / 56%
En retard
12
18%
Travail
Commandes similaires
Hello, I am looking for a highly experienced MQL5 developer to build a unique FTMO-compliant Hybrid EA that includes a Smart Scalper module, a Swing module, and a full prop-firm safety engine. Please confirm: Your experience with FTMO rules. Past EAs you created with risk control systems. If you build everything from scratch (no reused code). Delivery timeline. Price quote. If possible, please share: Examples of
Gege Squash V1 30 - 200 USD
I want a powerful MT5 Expert Advisor named 'Gege Squash Pro V.1'. It must work for forex and gold , make it available for all quotes of forex Robot must include: Trend direction filter Breakout entry system Stop loss + take profit auto-calculation Trailing stop Risk per trade settings Smart breakeven Optional signals on chart News filter (optional) Conditions: Must work on small accounts Low drawdown Medium risk No
Nice here’s a ready-to-compile MQL5 Expert Advisor called GegeSquashProV1 Code — GegeSquashProV1.mq5 Copy this into MetaEditor (or mql5.com cloud editor), compile, then upload the compiled EA to your MT5 Android. //+------------------------------------------------------------------+ //| GegeSquashProV1.mq5 | //| Author: ChatGPT (template for user "Gege") | //| Strategy: EMA crossover + RSI filter + ATR SL/TP + Risk
I am looking for an experienced MT5 Expert Advisor developer who can build a price-action and structure-based automated strategy for XAUUSD . This EA must follow a clearly defined logic flow based on market structure shifts, break/confirmation rules, and zone-based entries , using closed-candle calculations only (no repainting, no indicator dependency). The EA includes: structure and swing detection confirmation of
I want an Expert Advisor that is based on core high-frequency scalping strategy. The EA will continuously place pending buy stop and sell stop orders at a fixed distance from the current Bid price, creating a grid around the price action. When price moves and triggers one of these orders, the EA will immediately close the opposite pending order and then place a new pair of buy and sell stop orders around the new
Hello. We are looking for a group of developers or a software company to create a website that offers services for forex and futures traders. We need assistance with website development, launching service sales, and monitoring traders' accounts. If you have experience building websites and integrating service sales, please apply for this job
Hello. We are looking for a group of developers or a software company to create a website that offers services for forex and futures traders. We need assistance with website development, launching service sales, and monitoring traders' accounts. If you have experience building websites and integrating service sales, please apply for this job
Footprint-based Reversal Entry EA with Multi-Filter Logic We’re seeking an experienced MQL5 developer to build an MT5 EA that enters trades based on reversal patterns detected from the ClusterDelta #Footprint indicator (CME futures volume). The EA must be flexible enough to trade GBPUSD and USDJPY, with parameters adaptable to any pair. Core requirements (see attached specification for full details): Trend Filter
https://www.youtube.com/live/Fn6ucmWyuAA?si=x96zzN07q8Diif8a To build a fully automated AI-style trading robot similar to the one demonstrated in the video, which opens, manages, and closes trades automatically based on adaptive market behavior. The system should visually and functionally resemble the performance shown in the video but include transparent, editable logic for long-term optimization
I need a developer for a Python-based trade copier with a web dashboard that copies trades from a master account to one or more slave accounts. We discuss about the timeline and price. Only experienced developer should bid for this. Thanks

Informations sur le projet

Budget
44+ USD
Délais
de 1 à 3 jour(s)