Aggressive scalp ea - page 17

 

As of 02.00 pm

02.40am: 77.461 usd * 02.00pm:97.430 usd diff:19.969 usd

 
 
Bongo:
Go to sample - Moving Averege EA:

//+------------------------------------------------------------------+

//| Calculate open positions |

//+------------------------------------------------------------------+

int CalculateCurrentOrders(string symbol)

{

int buys=0,sells=0;

//----

for(int i=0;i<OrdersTotal();i++)

{

if(OrderSelect(i,SELECT_BY_POS,MODE_TRADES)==false) break;

if(OrderSymbol()==Symbol() && OrderMagicNumber()==MAGICMA)

{

if(OrderType()==OP_BUY) buys++;

if(OrderType()==OP_SELL) sells++;

}

}

yes, this code can be used, but I do not want to buy or sell a limit.

 

Hi escape

Does this escape 2 EA run on fxopen broker? if it can run,how to modify setting? Thanks

Sorry for my bad English!

 

escape can u post the EA with ur current settings set files... for 5 digit broker?

thanks

 

I am starting to catch on to the thing..

Files:
 

extern double lTakeProfit = 10;

extern double sTakeProfit = 10;

extern double lTrailingStop = 20;

extern double sTrailingStop = 10;

extern color clOpenBuy = Green;

extern color clCloseBuy = Aqua;

extern color clOpenSell = Red;

extern color clCloseSell = Violet;

extern color clModiBuy = Blue;

extern color clModiSell = Red;

extern string Name_Expert = "escape";

extern int Slippage = 1;

extern bool UseSound = false;

extern string NameFileSound = "Alert.wav";

extern double Lots = 0.1;

void deinit() {

Comment("");

}

//+------------------------------------------------------------------+

//| |

//+------------------------------------------------------------------+

int start(){

if(Bars<50){

Print("bars less than 50");

return(0);

}

if(lTakeProfit<0.5){

Print("TakeProfit less than 0.5");

return(0);

}

if(sTakeProfit<0.5){

Print("TakeProfit less than 0.5");

return(0);

}

double diClose0=iClose(NULL,5,0);

double diMA1=iMA(NULL,5,5,0,MODE_SMA,PRICE_OPEN,1);

double diClose2=iClose(NULL,5,0);

double diMA3=iMA(NULL,5,4,0,MODE_SMA,PRICE_OPEN,1);

if(AccountFreeMargin()<(1000*Lots)){

Print("We have no money. Free Margin = ", AccountFreeMargin());

return(0);

}

if (!ExistPositions()){

if ((diClose0<diMA1)){

OpenBuy();

return(0);

}

if ((diClose2>diMA3)){

OpenSell();

return(0);

}

}

TrailingPositionsBuy(lTrailingStop);

TrailingPositionsSell(sTrailingStop);

return (0);

}

bool ExistPositions() {

for (int i=110; i<OrdersTotal(); i++) {

if (OrderSelect(i, SELECT_BY_POS, MODE_TRADES)) {

if (OrderSymbol()==Symbol()) {

return(True);

}

}

}

return(false);

}

void TrailingPositionsBuy(int trailingStop) {

for (int i=110; i<OrdersTotal(); i++) {

if (OrderSelect(i, SELECT_BY_POS, MODE_TRADES)) {

if (OrderSymbol()==Symbol()) {

if (OrderType()==OP_BUY) {

if (Bid-OrderOpenPrice()>trailingStop*Point) {

if (OrderStopLoss()<Bid-trailingStop*Point)

ModifyStopLoss(Bid-trailingStop*Point);

}

}

}

}

}

}

void TrailingPositionsSell(int trailingStop) {

for (int i=110; i<OrdersTotal(); i++) {

if (OrderSelect(i, SELECT_BY_POS, MODE_TRADES)) {

if (OrderSymbol()==Symbol()) {

if (OrderType()==OP_SELL) {

if (OrderOpenPrice()-Ask>trailingStop*Point) {

if (OrderStopLoss()>Ask+trailingStop*Point ||

OrderStopLoss()==0)

ModifyStopLoss(Ask+trailingStop*Point);

}

}

}

}

}

}

void ModifyStopLoss(double ldStopLoss) {

bool fm;

fm = OrderModify(OrderTicket(),OrderOpenPrice

(),ldStopLoss,OrderTakeProfit(),0,CLR_NONE);

if (fm && UseSound) PlaySound(NameFileSound);

}

void OpenBuy() {

double ldLot, ldStop, ldTake;

string lsComm;

ldLot = GetSizeLot();

ldStop = 0;

ldTake = GetTakeProfitBuy();

lsComm = GetCommentForOrder();

OrderSend(Symbol

(),OP_BUY,ldLot,Ask,Slippage,ldStop,ldTake,lsComm,0,0,clOpenBuy);

if (UseSound) PlaySound(NameFileSound);

}

void OpenSell() {

double ldLot, ldStop, ldTake;

string lsComm;

ldLot = GetSizeLot();

ldStop = 0;

ldTake = GetTakeProfitSell();

lsComm = GetCommentForOrder();

OrderSend(Symbol

(),OP_SELL,ldLot,Bid,Slippage,ldStop,ldTake,lsComm,0,0,clOpenSell);

if (UseSound) PlaySound(NameFileSound);

}

string GetCommentForOrder() { return(Name_Expert); }

double GetSizeLot() { return(Lots); }

double GetTakeProfitBuy() { return(Ask+lTakeProfit*Point); }

double GetTakeProfitSell() { return(Bid-sTakeProfit*Point); }

 

 
escape:

Hello which version you are using? thanks.

 

Thanks for your code. but it still cann't run in the FXOpen brokers,but the escape 2 EA run on FXDD is no promble. I don't know why when I set the take profit as 2-3 point,it does'n run. It only can run between 8-20 points. Can you please help me to modify the code again? I only want to run between 2-3 points.