New function profit counting and closing

MQL4 Experts Integration

Specification


I would like to have a new function in my EA.

later i will upload the EA for Integration in the EA


New Funktion:

 

extern …….   useBasketprofitpct_Low_high=true;          //new function

extern …….. basketprofitpct_Low_high=2;                         //new function

 

If „extern bool   useBasketprofitpct_Low_high=true;“
„extern ……. basketprofitpct_Low_high=2; „

>>count-profit-closed-buy-position (like „extern bool   useBasketprofitpct=true;“ but only the buy-posistions)
>>count-profit-open-buy-posistions
>>count-profit-of-the-lowest-open-sell-position
>>if (profit-closed-buy-positions (similar like „useBasketprofitpct“) + profit-open-buy-posistions + profit-of-the-lowest-open-sell-posistion >=basketprofitpct_low_high*0.01*AccountBalance()
                then close all open buy-posistions and the lowest-open-sell-position

 

>>count-profit-closed-sell-position (like „extern bool   useBasketprofitpct=true;“ but only the sell-posistions)
>>count-profit-open-sell-posistions
>>count-profit-of-the-highest-open-buy-position
>>if (profit-closed-sell-positions (similar like „useBasketprofitpct“) + profit-open-sell-posistions + profit-of-the-highest-open-buy-posistion >=basketprofitpct_low_high*0.01*AccountBalance()
                then close all open sell-posistions and the highest-open-buy-position

 

 


 

 

Function in the EA: „useBasketprofitpct“

 

   if(useBasketprofitpct)

     {

      if(basketpercentflag=="CLOSE")if(countall(1)==0)basketpercentflag="";

      if(countprofit(1)>=nd(basketprofitpct*0.01*AccountBalance(),2) || countprofit(1)<=-1*nd(basketlosspct*0.01*AccountBalance(),2)) basketpercentflag="CLOSE";

      if(basketpercentflag=="CLOSE")

        {

         close(OP_BUY);close(OP_SELL);deletes(7);deletes(8);

         timex=TimeCurrent();

        }

      //Comment("\nprofit = "+DoubleToStr(countprofit(1),2));

     }

 

>>>>>>>/// i wanna the same just only for the buy and the sell-posistions and adding the lowestsellposion and hightestbuyposistion!

 



Responded

1
Developer 1
Rating
(365)
Projects
507
40%
Arbitration
147
18% / 72%
Overdue
99
20%
Loaded
2
Developer 2
Rating
(298)
Projects
427
26%
Arbitration
18
61% / 33%
Overdue
26
6%
Free
Published: 8 codes
3
Developer 3
Rating
(53)
Projects
79
18%
Arbitration
13
15% / 54%
Overdue
5
6%
Free
4
Developer 4
Rating
(258)
Projects
395
28%
Arbitration
69
19% / 49%
Overdue
120
30%
Free

Project information

Budget
20 - 30 USD
For the developer
18 - 27 USD
Deadline
from 2 to 3 day(s)