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
Hi guys I would like to k ow if someone has experience with machine learning models? I would like to train a model to identify if there is a range market or trendy market based on several parameters like EMA and ATR for example. If we use for example a 20 and 50 EMA and we measure the distance between both lines the algo should oearn if the trend is strong or weak. If it‘s steong it keeps trending and if it‘s weak
Hello The EA will work on particular zone choose by the user and can mark it on any TF and with some rules can open trades and mange the trade by some unique rules. the EA need to check the difference by RSI as well and with some extra rules . developer should have good attitude and good communication (englsih) with high performence and knowledge with coding EA. THREE TYPES OF ENTRIES 1: AGGRESSIVE 2: DIVERGENCE 3
Indicator in use: Bollinger Bands Mechanism (See diagrams provided for help) Sells: 1. Trigger candle: When candle low is above the top Bollinger band - accurate to the lowest point scale (e.g. On EURUSD if candle low is 1.07915 and the value of top bollinger is 1.07914 - this is a sell signal; or if on Futures if the increment is .25 or .10 then this is used) 2. Enter sell ONLY on the next candle if price breaks
I need a simple panel to execute both buy and sell operations with very basic things like stopp loss take profit that functions for both market orders such as buy stop sell stop buy limit sell limit I don't care about colors or design I just want how you can do it what interests me most are the functions
I want to create an EA that can take bids according to information of a logic I have developed to give indication of a BUY or SELL opportunity. The EA will then be able to activate the BUY at the lowest possible position once the indicator clears it for a BUY and take bid upwards or identify the highest point and clears it for a SELL and take bids downwards. As you can see from example of JULY 2024 data to see how
Hello, I‘m interested in an indicator to predict the next candles probability (bullish or bearish). But honestly I have no idea how to do this. Would be interested in your opinion how we can create such an indicator. Please let me know if you‘ve done similar work
Hey greetings. Am in need of a developer that has already made profitable MT4 or MT5 EA that I can buy with the backtesting and proven result. How is the draw down ? What is the winning rate ? Kindly reply and let proceed
I need a TradingView script (not mine) converted to an Mt5 EA. There is some specifications for the robots on when to be able to take a trade. Attached bellow is the file of the script I want translated and converted to MT5 then EA
GOODAY TO YOU I AM NEED OF A FAST, TALENTED AND HIGH QUALITY CODER TO THIS JOB FOR ME. THE EA TRADE MANAGER WILL HAVE THE FOLLOWING: STOPLOSS & TAKEPROFIT IN PIPS LOT SIZE IN PIPS NUMBER OF TRADES (1-30 TRADES MAXIMUM) PLEASE LOOK AT THE PICTURE ABOVE FOR A GUIDE
evalq({ #نوع دالة التنشيط. الحقيقة <- c( "sig" , #: sigmoid "sin" , #: sine "radbas" , #: radial basis "hardlim" , #: hard-limit "hardlims" , #: symmetric hard-limit "satlins" , #: satlins "tansig" , #: tan -sigmoid "tribas" , #: triangular basis "poslin" , #: positive linear "purelin" ) #: linear السندات

Informations sur le projet

Budget
44+ USD
Pour le développeur
39.6 USD
Délais
de 1 à 3 jour(s)