Aggressive scalp ea - page 20

 

correcting myself: works quite well actualy but my scripting skills suck

 
 

escape works good

hi all,

just wanted say, i'm the EA from one week, it works good, if u use it semi-auto, only buy or only sell, looking at the market trend. traded for 2 hours using semi-auto look at the statement

Files:
stat26.htm  57 kb
 

hi,

sorry, "i'm using the EA from one week"

 
escape:

escape

This is how you set up, and how I use only to sell, not buy?

 

This is how you set up, and how I use only to sell, not buy?

Files:
sell.jpg  63 kb
 
escape:
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); }

This code works well with my prime4x demo account, but will not work at all in my collectivefx demo account. It may be that thecollectivefx.com is an ECN style broker, and may process orders a little differently. That's just a guess. Does anyone know what this difference is, and what part of the code could be changed to compensate for the difference?

 
PC Biz:
This code works well with my prime4x demo account, but will not work at all in my collectivefx demo account. It may be that thecollectivefx.com is an ECN style broker, and may process orders a little differently. That's just a guess. Does anyone know what this difference is, and what part of the code could be changed to compensate for the difference?

do you know what error messages you are getting in the journal..?

 
Blaiserboy:
do you know what error messages you are getting in the journal..?

There were no error messages, just no orders initiated. The EA loads correctly, but that's it. I've also added an extra 0 to the inputs to compensate for the five digit prices. No difference at all.

If they're still available, open a demo account at thecollectivefx.com and try it on their MT4 client.

 

Sorry, I have no idea....

Hopefully someone else can provide a solution.

Reason: