Coders (any coder) are coding for free:
- if it is interesting for them personally, or
- if it is interesting for many members of this forum.
----------------
and Freelance section of the forum should be used in most of the cases.
- 2024.02.13
- www.mql5.com
Coders (any coder) are coding for free:
- if it is interesting for them personally, or
- if it is interesting for many members of this forum.
----------------
and Freelance section of the forum should be used in most of the cases.
i am learning so i want someone to just give me hint so i can do on my own i cant afford to hire someone
I have a grid system which takes Buy trades whenever market hit lower Bollinger line. and then it keeps on trading after every -200 points and then my ea calculates the average price and set take profit of all running trades to 250 points.
the problem is that right now my system is working on single grid system.
i want my ea to open multiple grid trades whenever market hit lower Bollinger line and then calculate average price and take profit for each individual grid..
i have this confusion : how to identify how many trades are running in Grid 1, grid 2 and so on. and then execute average price and take profit function to each grid separately.
i have everything ready thats why my single grid function is working accurately.
now i just need to fix on thing. how to identify which trades are from grid 1 and which trades are from grid 2 so i can run my already made average price and modify take profit functions on each individual grid
i have everything ready thats why my single grid function is working accurately.
now i just need to fix on thing. how to identify which trades are from grid 1 and which trades are from grid 2 so i can run my already made average price and modify take profit functions on each individual grid
I repeat, you need a storage class for each grid in such way, that you can instantiate each grid individually. Then you store each newly opened positions ticket in the storage class of the corresponding grid.
This is not very difficult to do, actually. - It is in fact more or less a refactoring of your current code. - You should be able to do it, or you share the code here, and maybe someone wants to help you with your task.
Everything has been said on this thread so far for you to act now. - Its not on us to provide further support without action on your side, as far it concerns me.
void Sell_Trade() { // Declare a two-dimensional array to store position information double SellArrayInfo[500][5]; if (IsNewBar()) { Sellreset = 0; Ssigma = s(); BidPrice = NormalizeDouble(SymbolInfoDouble(_Symbol, SYMBOL_BID), _Digits); if ( (Ssigma == 2) && (Sellreset==0) ) { // Print("Sell"); double SellSL = NormalizeDouble((StopLoss == 0 ? 0 : BidPrice + StopLoss * _Point),_Digits); double SellTP = NormalizeDouble((BidPrice - TakeProfit * _Point),_Digits); if(trade.Sell(LotSize,_Symbol,BidPrice,SellSL,SellTP)) { Sellreset=1; } } } for (int i = 0; i <= SellTradeCount() -1; i++) { ulong Sellticket = PositionGetTicket(SellTradeCount() - 1); if (PositionSelectByTicket(Sellticket)) // Select the position by its ticket { if(PositionGetInteger(POSITION_TYPE) == POSITION_TYPE_SELL) { Sellticket = PositionGetInteger(POSITION_TICKET); double SelltradeLotSize = PositionGetDouble(POSITION_VOLUME); SellOpenPrice = PositionGetDouble(POSITION_PRICE_OPEN); double SelltradeIfTraded = 0; // 0 for false, 1 for true SelltradeOpenPrice = NormalizeDouble((SellOpenPrice + Points_to_Wait * _Point),_Digits); double SelltradePriceType = 1; // 0 for buy & 1 for sell SellArrayInfo[i][0] = (double)Sellticket; SellArrayInfo[i][1] = SelltradeLotSize; SellArrayInfo[i][2] = SellOpenPrice; SellArrayInfo[i][3] = SelltradeIfTraded; SellArrayInfo[i][4] = SelltradeOpenPrice; if (BidPrice >= SelltradeOpenPrice) //&& (trading_allowed==true) ) { double SellSL = NormalizeDouble((StopLoss == 0 ? 0 : BidPrice + StopLoss * _Point),_Digits); double SellTP = NormalizeDouble((BidPrice - TakeProfit * _Point),_Digits); if (trade.Sell(LotSize,_Symbol,BidPrice,SellSL,SellTP) ) { Sell_UpdateAverageInfo(); ModifySell(); } } } } } }
thats my code please can anyone help now ?
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
the problem is that right now my system is working on single grid system.
i want my ea to open multiple grid trades whenever market hit lower Bollinger line and then calculate average price and take profit for each individual grid..
i have this confusion : how to identify how many trades are running in Grid 1, grid 2 and so on. and then execute average price and take profit function to each grid separately.