A simple expert advisor scanning multiple codes

MQL5 Эксперты C++

Работа завершена

Время выполнения 4 дня
Отзыв от заказчика
Very helpful
Отзыв от исполнителя
Thanks! Nice customer.. hoping that we will work together again:)

Техническое задание

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.



Откликнулись

1
Разработчик 1
Оценка
(57)
Проекты
72
22%
Арбитраж
13
46% / 15%
Просрочено
5
7%
Свободен
2
Разработчик 2
Оценка
(58)
Проекты
66
8%
Арбитраж
39
26% / 56%
Просрочено
12
18%
Работает
Похожие заказы
I am looking for an experienced MQL5 developer to help me finalize and optimize an Expert Advisor (EA) for the FTMO challenge. I have already built a significant portion of the code, but it requires further refinement and optimization to ensure it functions according to the trading strategy I intend to use. I am happy to share all the resources, including the current code, reference materials, and detailed
dreams good and have a great Cash out from your smart phone , tuyoywuiy glamorous flood see full idk idk slow so dolls stupid sis workouts who's spark koalas oral waits also doggo idk
BUY AND SELL 30+ USD
Create an Expert Advisor that collaborates between these indicators ETR, MEv2 and STLv3 with these features 1. SL and TP 2. TIME FILTER 3. ETR, MEv2 and STLv3 PARAMETERS BUY ENTRY STEP 1. FIRST candle OPEN above Symphonie Trend Line STEP 2. Check Symphonie Extreme must indicate color BLUE STEP 3. Check Symphonie Emotion must indicate color BLUE STEP 4. Open trade with money management STEP 5. Trade open MUST BE 1
EA MT5 SNR 30 - 100 USD
I need a developer who can work with quickly & details. make an EA MT5 Classic Support aNd Resistance multi time frame marking single Classic support and resistance support type A and Resistance type V make an alert pop-up
Excellent trade 30 - 40 USD
I need a developer that will modify an EA that is made using 4 indicators, example, volume, average true range,RSI and MFI, this EA is user input and input adjustable, any programmer that can do this job should Apply and lets proceed
hi, just like mt5 plateform. there is one another new platefrom called TM9 whose website is( https://trademaster9.com/site/index.html ) i want you to create an API intigration to connect mt5 or mt4 plateform to this platform. i want you to create a copy trading software which can copy trade from mt5/mt4 to trade master 9 plateform. for more information please contact me directly. PRICE CAN BE NEGOTIATED. looking
Requirement: 1. Convert Pivot source code .mq4 to Sierra Chart mq4 source code is provided .mq4 as attached .mq4 2. upon conversion to add a button code on Sierra chart .cpp to allow display/hide the pivot line in Sierra Chart ---- *no need alert, make it light without any alert, just a button to display/hide pivot line will do :) to continue, pivot font text also no need I"ve mark with red cross to remove see
I have 2 (indicators) I coded and I use on Tradingview I just need converted to use on Ninjatrader i will be looking for great developer to bid for it and for more details
Hello, I'm seeking a freelancer with access to a ready-made server solution for an educational forex project. Requirements: Ability to control or manipulate live or historical trading data. Platform to execute simulated trades with exaggerated outcomes. Tools for real-time trade simulation (white-label or virtual dealer solutions). If you have a suitable server or can help me find one, please reach out with details
hello here am looking for someone that can assist me in removing validation form my demo file and if anyone is interested dm the for more details i will be waiting to get any reply by some on that can assist me with this

Информация о проекте

Бюджет
44+ USD
Исполнителю
39.6 USD
Сроки выполнения
от 1 до 3 дн.