ÇOK basit bir EA oluşturmak için yardıma ihtiyacınız var - sayfa 7

 
doshur :

//+------------------------------------------------------------------+
//| Stepper.mq4 |
//| doshur |
//| www.doshur.com |
//+------------------------------------------------------------------+
#property copyright "doshur"
#property link "www.doshur.com"

extern int TakeProfit = 5;
extern int Range = 20;
extern int Risk = 2;

//+------------------------------------------------------------------+
//| expert initialization function |
//+------------------------------------------------------------------+
int init()
{
return(0);
}

int deinit()
{
return(0);
}

int start()
{
//----
static bool ToTrade = false;
static bool FirstTrade = true;

double PrevLow = iLow(Symbol(), 0, 1);
double PrevHigh = iHigh(Symbol(), 0, 1);
double PrevRange = (PrevHigh - PrevLow) / Point;

if(NewBar())
{
if(FirstTrade == false)
{
if(PrevRange >= Range)
ToTrade = true;
else
ToTrade = false;
}
else
{
FirstTrade = false;
}
}

if(ToTrade)
{
if(COT(1) < 1)
{
if(Ask > PrevHigh)
OrderSend(Symbol(), OP_BUY, MM(PrevRange, Risk), Ask, 3, PrevLow, Ask + TakeProfit * Point, "Stepper - BUY", 57390, 0, Blue);
}

if(COT(2) < 1)
{
if(Bid < PrevLow)
OrderSend(Symbol(), OP_SELL, MM(PrevRange, Risk), Bid, 3, PrevHigh, Bid - TakeProfit * Point, "Stepper - SELL", 57391, 0, Red);
}
}
//----
return(0);
}
//+------------------------------------------------------------------+

//---- Check Is New Bar
bool NewBar()
{
static datetime PrevBar;

if(PrevBar < Time[0])
{
PrevBar = Time[0];
return(true);
}
else
{
return(false);
}

return(false);
}

//---- Check Open Trades
int COT(int BS)
{
int Buys = 0, Sells = 0;

for(int cnt_COT = 0; cnt_COT < OrdersTotal(); cnt_COT++)
{
OrderSelect(cnt_COT, SELECT_BY_POS, MODE_TRADES);

if(OrderType() == OP_BUY && OrderSymbol() == Symbol()) Buys++;
if(OrderType() == OP_SELL && OrderSymbol() == Symbol()) Sells++;
}

if(BS == 1) return(Buys);
if(BS == 2) return(Sells);
}

//---- Money Management
double MM(int SL, int RK)
{
double rLots = NormalizeDouble(AccountBalance() / 1000 * RK / SL, 1); // Risk ?% of balance

if(rLots < 0.1) rLots = 0.1;

return(rLots);
}


Sorunun ve bazılarının üstesinden gelmek için ilk çalıştırmayı uygulamıştı

kodu test etmemiştim

Lütfen diğer değişiklikleri test edin ve listeleyin


lütfen yardım edin, denedim ama bu EA'nın çalışmasını sağlayamadım.

belki yanlış mt4 platformunu kullanıyorum ya da ???

yani fx-open kullanıyorum

ve/veya deneyebileceğim daha yeni bir sürüm var mı?