mx





//------------------------------------------------------------------------------
//                                                                          mx |
//------------------------------------------------------------------------------
extern double SL=10;
extern double TP=10;
extern double TS=5;

int MAGIC=12345;
double Lots=1.0,diClose0,sMM,fMM;
//------------------------------------------------------------------------------
int init() {return(0);}
int deinit(){return(0);}
//------------------------------------------------------------------------------
int start(){
	//
	diClose0=iClose(NULL,PERIOD_M15,0);
	fMM=iMA(NULL,PERIOD_M15,5,0,3,2,0);
	sMM=iMA(NULL,PERIOD_M15,7,0,3,2,0);
	//
	if(OrdersTotal()<1){
		if(diClose0<sMM){
			OrderSend(Symbol(),OP_BUY,Lots,Ask,2,Ask-Point*SL,Ask+Point*TP,"",MAGIC,0,CLR_NONE);
		}
		if(fMM<diClose0){
			OrderSend(Symbol(),OP_SELL,Lots,Bid,2,Bid+Point*SL,Bid-Point*TP,"",MAGIC,0,CLR_NONE);
		}
	}
	TrailStop(TS);
	return(0);
}
//------------------------------------------------------------------------------
void TrailStop(double TS_){
	bool OM;
	int Ticket;
	double OOP,OTP;
	int TotalOrders=OrdersTotal();
	for(int n=OrdersTotal()-1;n>=0;n--){
		if(OrderSelect(n,SELECT_BY_POS,MODE_TRADES)){
			OOP=OrderOpenPrice();
			OTP=OrderTakeProfit();
			if(0<TS_ && OrderSymbol()==Symbol() && OrderMagicNumber()==MAGIC){
				if(OrderType()==OP_BUY){
					if(Point*TS_ < Bid-OrderOpenPrice()){
						if(OrderStopLoss() < Bid-Point*TS_){
							OrderModify(OrderTicket(),OOP,Bid-Point*TS_,OTP,0,CLR_NONE);
							return(0);
						}
					}
				}
				if(OrderType()==OP_SELL){
					if(Point*TS_ < (OrderOpenPrice()-Ask)){
						if((Ask+Point*TS_ < OrderStopLoss()) || (OrderStopLoss()==0)){
							OrderModify(OrderTicket(),OOP,Ask+Point*TS_,OTP,0,CLR_NONE);
							return(0);
						}
					}
				}
			}else{
				Print("Error : ",GetLastError());
			}
		}
	}
}
//------------------------------------------------------------------------------



Sample





Analysis



Market Information Used:

Series array that contains close prices for each bar


Indicator Curves created:


Indicators Used:

Moving average indicator


Custom Indicators Used:

Order Management characteristics:
Checks for the total of open orders
It automatically opens orders when conditions are reached

It can change open orders parameters, due to possible stepping strategy

Other Features:

BackTest : EURUSD on H1

From 2009-11-01 to 2009-11-30 Profit Factor:0.00 Total Net Profit:0.00

BackTest : USDJPY on H1

From 2009-11-01 to 2009-11-30 Profit Factor:0.00 Total Net Profit:0.00

BackTest : USDCHF on H1

From 2009-12-01 to 2010-01-01 Profit Factor:0.00 Total Net Profit:0.00

BackTest : EURUSD on H1

From 2009-12-01 to 2010-01-17 Profit Factor:0.00 Total Net Profit:0.00

BackTest : USDCAD on H1

From 2009-12-01 to 2010-01-01 Profit Factor:0.00 Total Net Profit:0.00

BackTest : EURUSD on H1

From 2009-08-01 to 2009-10-01 Profit Factor:0.00 Total Net Profit:0.00

BackTest : GBPUSD on H1

From 2010-01-01 to 2010-02-27 Profit Factor:0.00 Total Net Profit:0.00

BackTest : EURUSD on H1

From 2010-04-01 to 2010-04-30 Profit Factor:0.00 Total Net Profit:0.00

BackTest : EURUSD on H1

From 2010-05-01 to 2010-05-31 Profit Factor:0.00 Total Net Profit:0.00

BackTest : EURUSD on H1

From 2010-06-01 to 2010-06-30 Profit Factor:0.00 Total Net Profit:0.00

Request Backtest for mx


From : (yyyy/mm/dd) To: (yyyy/mm/dd)

Pair: Period: