Hallo Ronald,
ich habe es folgendermaßen gelöst (vielleicht gibt es bessere Lösungen):
Code:
//---- input parameters
extern int OpenHour = 9; // Time to open, hours
extern int OpenMinute = 0; // Time to open, minutes
extern bool UseCurrSymbol = False; // Use one symbol only
extern bool UseOneAccount = False; // Use one account only
extern int NumberAccount = xxxxxx; // Account number
extern int Slippage = 4; // Slippage
extern double ShortEntry = 0;
extern double LongEntry = 0;
extern int Lots = 1;
extern double StopLoss = 100;
extern double TakeProfit = 100;
extern datetime Exp = D'18.11.2015 18:29:00';
extern int status = -1;
extern color clBuy = Blue; // Color of closing buy
extern color clSell = Red; // Color of closing sell
//+------------------------------------------------------------------+
//| expert start function |
//+------------------------------------------------------------------+
void start() {
if (UseOneAccount && AccountNumber()!=NumberAccount) {
Comment("Working on the account: "+AccountNumber()+"is PROHIBITED!");
return;
} else Comment("");
if (status==-1 && Hour()==OpenHour && Minute()==OpenMinute) {
//double AskPrice = Ask;
//double BidPrice = Bid;
if (Ask < LongEntry) {
if(LongEntry > 0) OrderSend(Symbol(),OP_BUYSTOP,Lots,LongEntrySlippage,LongEntry-StopLoss,LongEntry+TakeProfit,"Buy",0,Exp,clBuy);
} else {
if(LongEntry > 0) OrderSend(Symbol(),OP_BUYLIMIT,Lots,LongEntry,Slippage,LongEntry-StopLoss,LongEntry+TakeProfit,"Buy",0,Exp,clBuy);
};
}
//return(0);
Grüße, Dieter