Você está perdendo oportunidades de negociação:
- Aplicativos de negociação gratuitos
- 8 000+ sinais para cópia
- Notícias econômicas para análise dos mercados financeiros
Registro
Login
Você concorda com a política do site e com os termos de uso
Se você não tem uma conta, por favor registre-se
//+------------------------------------------------------------------+
//| 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);
}
Tinha implementado uma primeira corrida para superar a questão e algumas outras
Não tinha testado o código
Teste e liste abaixo outras emendas
por favor, ajude-me, tentei mas não consegui fazer com que esta EA funcionasse.
talvez eu use a plataforma mt4 errada ou ????ou seja, eu uso fx-open
e /ou existe uma versão mais recente que eu possa tentar ?