New function profit counting and closing

MQL4 专家 积分

指定


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!

 



反馈

1
开发者 1
等级
(365)
项目
507
40%
仲裁
147
18% / 72%
逾期
99
20%
已载入
2
开发者 2
等级
(298)
项目
427
26%
仲裁
18
61% / 33%
逾期
26
6%
空闲
发布者: 8 代码
3
开发者 3
等级
(53)
项目
79
18%
仲裁
13
15% / 54%
逾期
5
6%
空闲
4
开发者 4
等级
(258)
项目
395
28%
仲裁
69
19% / 49%
逾期
120
30%
空闲

项目信息

预算
20 - 30 USD
开发人员
18 - 27 USD
截止日期
 2  3 天