
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
//+------------------------------------------------------------------+
//| 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);
}
Had implemented a first run to overcome the issue and some others
Had not tested the code
Pls test and list down other ammendments
please help, i have tried but have not been able to get this EA to work.
maybe i use the wrong mt4 platform or ???i.e. i use fx-open
and /or is there a newer version i can try ?