BTC USD 86,608.0 Gold USD 4,361.27
Time now: Jun 1, 12:00 AM

EA Close All bila sampai target bulanan di History

vastavista

Active Member
Messages
2,327
Joined
Jun 20, 2010
Messages
2,327
Reaction score
191
Points
33
Salam..

Aku lama fikir-fikir..tapi tk dapat ilham nk wt cami..

katakan kt history bulan ni aku dh dapat profit usd20.

yg dh close:
untung.th.png


kemudian..

position yg blum close masih dibawah negatif -USD10..

Yg masih floating
rugidepan.th.png


Jadi aku nk close All supaya aku dpt la untung USD10 tanpa floating..

Ada idea tak..?

Code:
ld_36 = AccountEquity() - AccountBalance();
   
   
   if (profitofthemonth() - (-ld_36)  >= profitofthemonth() / 2) {
   CloseBuySellSymbolAll();
   **

Tapi tk tk jalan gk..









Code untuk close All..

Code:
void CloseBuySellSymbolAll() {
   for (int l_pos_0 = OrdersTotal() - 1; l_pos_0 >= 0; l_pos_0--) {
      OrderSelect(l_pos_0, SELECT_BY_POS, MODE_TRADES);
               
            if (OrderType() == OP_BUY) OrderClose(OrderTicket(), OrderLots(), Bid, g_slippage_96, Blue);
            if (OrderType() == OP_SELL) OrderClose(OrderTicket(), OrderLots(), Ask, g_slippage_96, Red);
         Sleep(5000);
      
   **
**



Code untuk tgok bulan ni sampai target:-

Code:
double profitofthemonth() {
   double l_hist_total_0 = OrdersHistoryTotal();
   double ld_ret_8 = 0;
   for (int g_pos_272 = 0; g_pos_272 < l_hist_total_0; g_pos_272++) {
      OrderSelect(g_pos_272, SELECT_BY_POS, MODE_HISTORY);
      if (OrderMagicNumber() != g_magic_192) continue;
      if (OrderMagicNumber() == g_magic_192) {
         if (TimeMonth(OrderOpenTime()) == TimeMonth(TimeCurrent()))
            if (TimeYear(OrderOpenTime()) == TimeYear(TimeCurrent())) ld_ret_8 += OrderProfit();
      **
   **
   return (ld_ret_8);
**
 
Last edited:
aku dh settle problem ni...

ingat ade org leh bantu..rupanye tkde...
 

Latest Posts

Live Forex Chart

Currency
Rates
EUR / USD
1.14647
USD / JPY
157.322
GBP / USD
1.33705
USD / CHF
0.82107
USD / CAD
1.40302
EUR / JPY
180.353
AUD / USD
0.71202
Back
Top
Log in Register