Selasa, 18 Desember 2012

compounding lot

Master-master sekalian, ada gak yg bisa bantu newbie ni...
dah pusing googling nyari coding buat compounding lot (menggandakan lot) jika equity bertambah...
bisa tolong dibuatin dong master sekalian...
rulenya begini: min lot 0.01 jika last equity bertambah $40 dari start equity maka utk OP berikut lotnya ditambah 0.01 dari lot terakhir jadi setiap pertambahan equity $40 lot bertambah 0.01 pada op berikutnya jadinya equity 50 > 0.01 lot, 90 > 0.02 lot, dst. dan jika last equity berkurang $40 maka lot utk next OP dikurangi 0.01 dari lot last OP jadinya misal: equity 120 > 0.03 -$40 jadi 90 maka lotnya dikurangi 0.01 jadi 0.02 utk op berikutnya. minimal equity $50 minmal lotnya 0.01.
mohon bantuannya master-master maklum masih belajar

lot= (MathFloor ( AccountEquity() / 40 )) / 100 ; 
if (lot<0.01) { lot=0.01}


Makasi master atas rumusnya, maksud saya setiap penambahan $40 otomatis lot akan bertambah 0.01 pada saat ea op berikutnya dan sebaliknya jika berkurang. Sebenarnya saya sudah punya ea yg memakai perhitungan yg master berikan itu yaitu ea scalper 2010 eurousd. Moga ada master yg lain mau mampir utk beri petunjuk.

lot= lot_awal + (MathFloor ( (ekuity awal - AccountEquity() )/ 40 )) / 100 ; 
if (lot<0.01) { lot=0.01;}


Quote Originally Posted by pengen-profit View Post
lot= lot_awal + (MathFloor ( (ekuity awal - AccountEquity() )/ 40 )) / 100 ;
if (lot<0.01) { lot=0.01;}


coba Agan hitung pake kalkulator pasti cocok deh....

apa mendingan upload codingnya.. biar kita bisa lihat..

kalo keberatan codingnya di lihat.. minimal upload bagian yang hitung lotnya saja..




//|                                                   OP with MM.mq4 |
//|                                                        FxCielers |
//|                                Oprek from "pengen-profit script" |
//+------------------------------------------------------------------+

#property copyright "FxCielers"
#property link      "indo.mt5.com"
#property show_inputs
#include <stderror.mqh>
#include <stdlib.mqh>
 
extern double takeprofit=7;
 
extern double stoploss=30;
 
extern double slippage=3;
 
extern double risk0.001;
 
extern string _risk"0.001 berarti 0.1% untuk 10 pips";
 
double lotsize ;
 
extern bool buy true;
 
extern bool sell false;
 
//+------------------------------------------------------------------+
//| script program start function                                    |
//+------------------------------------------------------------------+
int start()
 { 
double tick=MarketInfo(Symbol(),MODE_TICKVALUE);
   
RefreshRates();
   while( 
IsTradeContextBusy() ) { Sleep(100); }
 
  {
int ticket;//----if (buy==false && sell==false)
{
Alert("Mau Buy apa Sell?? pilih salah satu dong..");Alert("Ulangi Lagi ya..!!!");
return (
0);
}
//----
  
lotsize= (AccountEquity()*risk/(10*tick)) ;
{
if (
buy==true)
ticketOrderSend(Symbol(),OP_BUY,lotsize,Ask,slippage*Point,Bid-stoploss*Point,Ask+takeprofit*Point,"FxCielers",0,0,Blue);
if (
ticket>0)
{
Alert("buy order sukses");

}
else
Alert("error opening buy order, error code = "ErrorDescription(GetLastError()));
}

if (
sell==true)
ticketOrderSend(Symbol(),OP_SELL,lotsize,Bid,slippage*Point,Ask+stoploss*Point,Bid-takeprofit*Point,"FxCielers",0,0,Red);
if (
ticket>0)
{
Alert("sell order sukses");

}
else
Alert("error opening sell order, error code = "ErrorDescription(GetLastError()));
}
}}

  }
//+------------------------------------------------------------------+  

Tidak ada komentar:

Posting Komentar