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%
작업중
비슷한 주문
My trust wallet was hacked and I have tokens to claim which unlock almost daily but the person who hacked the wallet drains the tokens as soon as I claim them in the hacked wallet. I have contacted the support for that crypto but they were not helpful. There is no way to claim this crypto to another wallet. I need a bot or another solution that can transfer the crypto out of the hacked wallet into my other wallet as
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 want to design a website like https://www.ngnrates.com/ we will change some stuff but not much, if you can deliver a website like this let me know your budget and readiness to implement
Hi, I need a robot, which wil get instructions to trade in 3 symbols at the same time based on few parameters and calculations. Example: There is 1 symbol called Gold-Near and the rate for it is 1000-1002 If i specify that when the rate reaches 1050, it should sell 1 lot Upon execution it will have to sell 1 lot of cme gold, buy 3 lots of mcx gold and buy currently (lots will be based on calculation). All the
Hello, i am searching for an experienced, professional software engineer, who can convert three Indicators from MQL4 to MQL5. This may sound like an easy job, but one indicator is like a trading system and therefore a bit complex. So you need to have a very good understanding of both languages. You should also be able to code MQL5 classes ( https://www.mql5.com/en/docs/basis/oop ). The intention is to code MQL5
I have a full code ,, There are some errors in this.It does not add to the chart, does not show arrow marks, does not alert ,, fix this problem and work properly,, Contact on telegram @Gw_rakib1
Hey, great developer I have a thinkorswim script I want to convert it into TradingView. Can you please let me know if you can i will be looking for great developer that will bid for it best regards
Hey, great developer I have a thinkorswim script I want to convert it into TradingView. Can you please let me know if you can i will be looking for great developer that will bid for it best regards
Tradingview developer 30 - 35 USD
Hey greetings. I am in need of tradingview developer that can modify an open source PineScript indicator code to add additional features. Kindly bid for this project if it is what you handle and let proceed with the project
hi. I hv a strategy on tradingview need to convert to MT4/MT5 expert advisor for algo trading. would like to add some tradingview strategy setting to the EA(not included in my tradingview code): recalculate after order is filled, order size: xx% of equity

프로젝트 정보

예산
44+ USD
개발자에게
39.6 USD
기한
에서 1  3 일