Inhalte aufrufen

  • Über Facebook anmelden Über Twitter anmelden Über WindowsLive anmelden Log In with Google Anmelden
  • Mitglied werden
Profilbild

Alarmfunktion

- - - - -

  • Du kannst leider keine neuen Themen eröffnen
  • Please log in to reply
30 Antworten zu diesem Thema

  #21
ONLINE   traderdoc

Ok, dann hast Du noch die alte Funktion start() verwendet.

 

Nun schreibst Du einfach CheckOrders(); am Besten vor die Zeile

if(EachTickMode && Bars!=BarCount) TickCheck=False;

und hängst meinen Code ganz unten einfach an.

 

traderdoc


Ich erfülle Euch gern Eure EA-, Indikator- und Script-Programmierwünsche.

 


  #22
OFFLINE   IDCBOI123

hatte ich ja glaube ich aber da kommt ja der Fehler.

 

int start() 
{
 int Order=SIGNAL_NONE;
 int Total,Ticket;
 double StopLossLevel,TakeProfitLevel;
 
void CheckOrders() {
 for (int i = OrdersTotal() - 1; i >= 0; i--) {
if (OrderSelect(i, SELECT_BY_POS, MODE_TRADES)) {
 if (OrderSymbol() == Symbol() && OrderMagicNumber() == Magic_Number) {  //sofern eine MagicNumber vergeben wurde, ansonsten das rechte Glied weglassen
if (!Alarm && iBarShift(NULL, 0, OrderOpenTime()) - xBars >= 0) {
 //Alarm
 Alarm = true;
}
break;
 }
}
 }
}
 if(EachTickMode && Bars!=BarCount) TickCheck=False;
 Total = OrdersTotal();
 Order = SIGNAL_NONE;


  #23
ONLINE   traderdoc

Ronny, ich hatte geschrieben

CheckOrders() in die start()-Funktion und nicht

void CheckOrders() {

...

}

 

Also:

Please Login or Register to see this Hidden Content

traderdoc


Ich erfülle Euch gern Eure EA-, Indikator- und Script-Programmierwünsche.

 


  #24
OFFLINE   IDCBOI123

Aber dann bekomm ich jetzt mehrmals den Fehler: 'if' - expressions are not allowed on a global scope

  #25
ONLINE   traderdoc

Dann stimmen bei Dir die Klammersetzungen nicht.

 

Das

void Checkorders() {

...

}

 

muss!!! außerhalb der start()-Funktion stehen.

 

traderdoc


Ich erfülle Euch gern Eure EA-, Indikator- und Script-Programmierwünsche.

 


  #26
OFFLINE   IDCBOI123

Hey Doc,

 

also ich probier schon die ganze Zeit aber irgendwie will es nicht klappen. 

Mit diesem CheckOrder bekomm ich überhaupt nicht hin. bekomme da dauend diese Fehlermeldungen. jetzt habe ich in Zeile 136 mal nur das mit dem Alarm eingefügt und in Zeile 135 eben die Notification dazu.

 

Jetzt sind zumindestens alle Alarme weg aber funktionieren tut es eben nicht richtig.

Ich bekomm jetzt halt immer ein Alarm sobald ein Order geöffnet wurde. Also nicht erst nach 1 xBars.

 

 

//+------------------------------------------------------------------+
//| This MQL is generated by Expert Advisor Builder  |
//|  

Please Login or Register to see this Hidden Content

|
//|  |
//|  In no event will author be liable for any damages whatsoever. |
//|  Use at your own risk. |
//|  |
//+------------------- DO NOT REMOVE THIS HEADER --------------------+
 
#define SIGNAL_NONE 0
#define SIGNAL_BUY 1
#define SIGNAL_SELL  2
#define SIGNAL_CLOSEBUY 3
#define SIGNAL_CLOSESELL 4
 
#property copyright "Expert Advisor Builder"
#property link  "

Please Login or Register to see this Hidden Content

 
extern int MagicNumber = 0;
extern bool SignalMail = True;
extern bool EachTickMode=True;
extern double Lots=1;
extern int Slippage=0;
extern bool UseStopLoss=False;
extern int StopLoss=100;
extern bool UseTakeProfit=False;
extern int TakeProfit=100;
extern bool UseTrailingStop=False;
extern int TrailingStop=30;
extern int EMA=30;
extern double PARAK=0.008;
extern double PARAL=0.001;
extern double A=26;
extern double B=52;
extern double C=26;
extern double D=52;
extern double G=0;
extern double K=0;
extern double BARWERT=100;
int BarCount;
int Current;
int ACTIVE;
bool TickCheck=False;
extern int xBars = 3;
bool Alarm;
extern bool Notification = false;
 
 
//+------------------------------------------------------------------+
//| expert initialization function |
//+------------------------------------------------------------------+
int init() 
{
 BarCount=Bars;
 
 if(EachTickMode) Current=0; else Current=1;
 
 return(0);
}
//+------------------------------------------------------------------+
//| expert deinitialization function |
//+------------------------------------------------------------------+
int deinit() 
{
 return(0);
}
//+------------------------------------------------------------------+
//| expert start function  |
//+------------------------------------------------------------------+
int start() 
{
 int Order=SIGNAL_NONE;
 int Total,Ticket;
 double StopLossLevel,TakeProfitLevel;
 
 
 if(EachTickMode && Bars!=BarCount) TickCheck=False;
 Total = OrdersTotal();
 Order = SIGNAL_NONE;
 
//+------------------------------------------------------------------+
//| Variable Begin |
//+------------------------------------------------------------------+
 
 
 
 
 
 
 
 
 
 
 
 
 
 int IROT = iIchimoku(NULL, 0, 9, C, D, MODE_TENKANSEN, Current + 0);
int IROT1 = iIchimoku(NULL, 0, 9, C, D, MODE_TENKANSEN, Current + 1);
int IBLAU = iIchimoku(NULL, 0, 9, C, D, MODE_KIJUNSEN, Current + 0);
int IA = iIchimoku(NULL, 0, 9, A, B, MODE_SENKOUSPANA, Current + 0);
int IB = iIchimoku(NULL, 0, 9, A, B, MODE_SENKOUSPANB, Current + 0);
int EMA0 = iMA(NULL,0,EMA,0,MODE_SMA,PRICE_CLOSE,0);
 
 
int BAR0C = iClose(NULL, 0,  0);
int BAR0O = iOpen(NULL, 0, 0);
int BAR1C = iClose(NULL, 0,  1);
int BAR1O = iOpen(NULL, 0, 1);
int BAR2C =  iClose(NULL, 0, 2);
int BAR2O =  iOpen(NULL, 0, 2);
int BAR3C =  iClose(NULL, 0, 3);
int BAR3O =  iOpen(NULL, 0, 3);
int BAR4C =  iClose(NULL, 0, 4);
int BAR4O =  iOpen(NULL, 0, 4);
int BAR0H = iHigh(NULL, 0,  0);
int BAR0L = iLow(NULL, 0, 0);
 
int BAR5O =  iOpen(NULL, 0, 100);
 
int BAR1H = iHigh(NULL, 0,  1);
int BAR1L = iLow(NULL, 0, 1);
 
bool NewBuyAllowed, NewSellAllowed, SS, BB;
 
//+------------------------------------------------------------------+
//| Variable End |
//+------------------------------------------------------------------+
 
//Check position
 bool IsTrade=False;
 
 for(int i=0; i<Total; i++) 
 {
OrderSelect(i,SELECT_BY_POS,MODE_TRADES);
if(OrderType()<=OP_SELL && OrderSymbol()==Symbol()&& OrderMagicNumber() == MagicNumber) 
 if (OrderSymbol() == Symbol() ) { 
if (!Alarm && iBarShift(NULL, 0, OrderOpenTime()) - xBars >= 1) 
 //Alarm
 Alarm = true;
 // if (Notification && Alarm) SendNotification("SELL signal on " + _Symbol);
  
  
  
 IsTrade=True;
 if(OrderType()==OP_BUY) 
  
 {
  
  
} else {
 
//+------------------------------------------------------------------+
//| Signal End(Exit Sell)  |
//+------------------------------------------------------------------+
 
  
 }
}
 }
 
 
//if ( (BAR1O > BAR1C) && (BAR2O < BAR2C) && (BAR3O > BAR3C) &&  (BAR1C < BAR2O ))  SS = 1; //
//if ((IBLAU > BAR1C )&&(IA - IB > G) && (BAR1O - IB > G) && (BAR1C - IB < K)) SS = 1;
//if ((IBLAU > BAR1C )&& (IB - IA > G) && (Close[0] - IA < K) && (BAR0O - IA > G))  SS = 1;
//if ((IBLAU > BAR1C )&&(IA - IB > G) && (BAR1O - IB > G) && (Ask - IB < K)) SS = 1;
//if ((IBLAU > BAR1C )&&(IA - IB > G) && (BAR1O - IB > G) && (BAR0L - IB < K)) SS = 1;
//if ((IBLAU > BAR1C )&&(IB - IA > G) && (BAR1O - IA > G) && (BAR0L - IA < K)) SS = 1;
 
if (BAR1C > BAR1O) SS = 1;
if (BAR1C < BAR1O) SS = 1;
 
if(SS == 1)
 Order = SIGNAL_SELL;
 
//+------------------------------------------------------------------+
//| Signal End |
//+------------------------------------------------------------------+
 
//Buy
 if(Order==SIGNAL_BUY && ((EachTickMode && !TickCheck) || (!EachTickMode && (Bars!=BarCount)))) 
 {
 if(!IsTrade )
{
 //Check free margin
 if(AccountFreeMargin()<(1000*Lots)) 
 {
Print("We have no money. Free Margin = ",AccountFreeMargin());
return(0);
 }
 
 if(UseStopLoss) StopLossLevel=Ask-StopLoss*Point; else StopLossLevel=0.0;
 if(UseTakeProfit) TakeProfitLevel=Ask+TakeProfit*Point; else TakeProfitLevel=0.0;
 
 Ticket=OrderSend(Symbol(),OP_BUY,Lots,Ask,Slippage,StopLossLevel,TakeProfitLevel,"Buy(#"+MagicNumber+")",MagicNumber,0,DodgerBlue);
 if(Ticket>0) 
 {
if(OrderSelect(Ticket,SELECT_BY_TICKET,MODE_TRADES)) 
{
 Print("BUY order opened : ",OrderOpenPrice());
 if(SignalMail) SendMail("[Signal Alert]","["+Symbol()+"] "+DoubleToStr(Ask,Digits)+" Open Buy");
 if (Alarm)
 if (Notification ) SendNotification("SELL signal on " + _Symbol);
 } else {
 Print("Error opening BUY order : ",GetLastError());
}
 }
 if(EachTickMode) TickCheck = True;
 if(!EachTickMode) BarCount = Bars;
 return(0);
}
 }
 
//Sell
 if(Order==SIGNAL_SELL && ((EachTickMode && !TickCheck) || (!EachTickMode && (Bars!=BarCount)))) 
 {
 if(!IsTrade )
{
 //Check free margin
 if(AccountFreeMargin()<(1000*Lots)) 
 {
Print("We have no money. Free Margin = ",AccountFreeMargin());
return(0);
 }
 
 if(UseStopLoss) StopLossLevel=Bid+StopLoss*Point; else StopLossLevel=0.0;
 if(UseTakeProfit) TakeProfitLevel=Bid-TakeProfit*Point; else TakeProfitLevel=0.0;
 
 Ticket=OrderSend(Symbol(),OP_SELL,Lots,Bid,Slippage,StopLossLevel,TakeProfitLevel,"Sell(#"+MagicNumber+")",MagicNumber,0,DeepPink);
 if(Ticket>0) 
 {
if(OrderSelect(Ticket,SELECT_BY_TICKET,MODE_TRADES)) 
{
 Print("SELL order opened : ",OrderOpenPrice());
 if(SignalMail) SendMail("[Signal Alert]","["+Symbol()+"] "+DoubleToStr(Bid,Digits)+" Open Sell");
 if (Notification && Alarm) SendNotification("SELL signal on " + _Symbol);
 
 } else {
 Print("Error opening SELL order : ",GetLastError());
}
 }
 if(EachTickMode) TickCheck = True;
 if(!EachTickMode) BarCount = Bars;
 return(0);
}
 }
 
 if(!EachTickMode) BarCount=Bars;
 
 return(0);
}
//+------------------------------------------------------------------+


  #27
ONLINE   traderdoc

Sorry, aber so wird das nix. In dem Du den Code der CheckOrders-Funktion nicht richtig eingebaut hast,
was ja auch gar nicht notwendig war, weil der als Funktion doch schon vorlag, hast Du nun ein andere
Programmsituation u.a. durch Weglassen von Klammern geschaffen.

Und genau das ist es, was ich mit dem Basteln meinte.

Baue den Code von mir so ein, wie ich es geschrieben hatte und Du wirst sehen, dass das funktioniert.

traderdoc

Ich erfülle Euch gern Eure EA-, Indikator- und Script-Programmierwünsche.

 


  #28
OFFLINE   IDCBOI123

kannst Du mir des net bitte einbauen in den EA....BIIIIITTTEEEEEE 



  #29
OFFLINE   IDCBOI123

Schau mal Doc jetzt hab ich es so und es kommt  der Fehler CheckOrders - function not defined.

 

int start() 
 
{{
 
 int Order=SIGNAL_NONE;
 int Total,Ticket;
 double StopLossLevel,TakeProfitLevel;
 
CheckOrders();
 
 if(EachTickMode && Bars!=BarCount) TickCheck=False;
 Total = OrdersTotal();
 Order = SIGNAL_NONE;
 //...
return(0);
}
 
 void CheckOrders() {
 for (int i = OrdersTotal() - 1; i >= 0; i--) {
if (OrderSelect(i, SELECT_BY_POS, MODE_TRADES)) {
 if (OrderSymbol() == Symbol() && OrderMagicNumber() == Magic_Number) {  //sofern eine MagicNumber vergeben wurde, ansonsten das rechte Glied weglassen
if (!Alarm && iBarShift(NULL, 0, OrderOpenTime()) - xBars >= 0) {
 //Alarm
 Alarm = true;
}
break;
 }
}
 }
}


  #30
OFFLINE   IDCBOI123

Also ich glaub jetzt hab ich es. jetzt ist nur noch ein Problem das ich das Alarm=true auf fals wieder bekomme. 

 

 

//+------------------------------------------------------------------+
//| This MQL is generated by Expert Advisor Builder  |
//|  

Please Login or Register to see this Hidden Content

|
//|  |
//|  In no event will author be liable for any damages whatsoever. |
//|  Use at your own risk. |
//|  |
//+------------------- DO NOT REMOVE THIS HEADER --------------------+
 
#define SIGNAL_NONE 0
#define SIGNAL_BUY 1
#define SIGNAL_SELL  2
#define SIGNAL_CLOSEBUY 3
#define SIGNAL_CLOSESELL 4
 
#property copyright "Expert Advisor Builder"
#property link  "

Please Login or Register to see this Hidden Content

 
extern int MagicNumber = 0;
extern bool SignalMail = True;
extern bool EachTickMode=True;
extern double Lots=1;
extern int Slippage=0;
extern bool UseStopLoss=False;
extern int StopLoss=100;
extern bool UseTakeProfit=False;
extern int TakeProfit=100;
extern bool UseTrailingStop=False;
extern int TrailingStop=30;
extern int EMA=30;
extern double PARAK=0.008;
extern double PARAL=0.001;
extern double A=26;
extern double B=52;
extern double C=26;
extern double D=52;
extern double G=0;
extern double K=0;
extern double BARWERT=100;
int BarCount;
int Current;
int ACTIVE;
bool TickCheck=False;
extern int xBars = 3;
bool Alarm;
extern bool Notification = false;
 
 
//+------------------------------------------------------------------+
//| expert initialization function |
//+------------------------------------------------------------------+
int init() 
{
 BarCount=Bars;
 
 if(EachTickMode) Current=0; else Current=1;
 
 return(0);
}
  
  
 
 
 
//+------------------------------------------------------------------+
//| expert deinitialization function |
//+------------------------------------------------------------------+
int deinit() 
{
 return(0);
}
//+------------------------------------------------------------------+
//| expert start function  |
//+------------------------------------------------------------------+
void CheckOrders() {
 for (int i = OrdersTotal() - 1; i >= 0; i--) {
if (OrderSelect(i, SELECT_BY_POS, MODE_TRADES)) {
 if (OrderSymbol() == Symbol() && OrderMagicNumber() == MagicNumber) {  //sofern eine MagicNumber vergeben wurde, ansonsten das rechte Glied weglassen
if (!Alarm && iBarShift(NULL, 0, OrderOpenTime()) - xBars >= 0) {
 //Alarm
 Alarm = true;
}
break;
 }
}
 }
}
 
 
 
int start() 
{
 int Order=SIGNAL_NONE;
 int Total,Ticket;
 double StopLossLevel,TakeProfitLevel;
 
CheckOrders();
 
 if(EachTickMode && Bars!=BarCount) TickCheck=False;
 Total = OrdersTotal();
 Order = SIGNAL_NONE;
 
 
 
 
 
 
 
//+------------------------------------------------------------------+
//| Variable Begin |
//+------------------------------------------------------------------+
 
 
 
 
 
 
 
 
 
 
 
 
 
 int IROT = iIchimoku(NULL, 0, 9, C, D, MODE_TENKANSEN, Current + 0);
int IROT1 = iIchimoku(NULL, 0, 9, C, D, MODE_TENKANSEN, Current + 1);
int IBLAU = iIchimoku(NULL, 0, 9, C, D, MODE_KIJUNSEN, Current + 0);
int IA = iIchimoku(NULL, 0, 9, A, B, MODE_SENKOUSPANA, Current + 0);
int IB = iIchimoku(NULL, 0, 9, A, B, MODE_SENKOUSPANB, Current + 0);
int EMA0 = iMA(NULL,0,EMA,0,MODE_SMA,PRICE_CLOSE,0);
 
 
int BAR0C = iClose(NULL, 0,  0);
int BAR0O = iOpen(NULL, 0, 0);
int BAR1C = iClose(NULL, 0,  1);
int BAR1O = iOpen(NULL, 0, 1);
int BAR2C =  iClose(NULL, 0, 2);
int BAR2O =  iOpen(NULL, 0, 2);
int BAR3C =  iClose(NULL, 0, 3);
int BAR3O =  iOpen(NULL, 0, 3);
int BAR4C =  iClose(NULL, 0, 4);
int BAR4O =  iOpen(NULL, 0, 4);
int BAR0H = iHigh(NULL, 0,  0);
int BAR0L = iLow(NULL, 0, 0);
 
int BAR5O =  iOpen(NULL, 0, 100);
 
int BAR1H = iHigh(NULL, 0,  1);
int BAR1L = iLow(NULL, 0, 1);
 
bool NewBuyAllowed, NewSellAllowed, SS, BB;
 
 
//+------------------------------------------------------------------+
//| Variable End |
//+------------------------------------------------------------------+
 
//Check position
 bool IsTrade=False;
 
 for(int i=0; i<Total; i++) 
 {
OrderSelect(i,SELECT_BY_POS,MODE_TRADES);
if(OrderType()<=OP_SELL && OrderSymbol()==Symbol() && OrderMagicNumber() == MagicNumber) 
{
 IsTrade=True;
 if(OrderType()==OP_BUY) 
 {
//Close
 
//+------------------------------------------------------------------+
//| Signal Begin(Exit Buy) |
//+------------------------------------------------------------------+
 
//  if ( BAR5O > Ask) Order = SIGNAL_CLOSEBUY;
 // if ( IA > IB && BAR0C < IB ) Order = SIGNAL_CLOSEBUY;
 
//+------------------------------------------------------------------+
//| Signal End(Exit Buy) |
//+------------------------------------------------------------------+
 
if(Order==SIGNAL_CLOSEBUY && ((EachTickMode && !TickCheck) || (!EachTickMode && (Bars!=BarCount)))) 
{
 OrderClose(OrderTicket(),OrderLots(),Bid,Slippage,MediumSeaGreen);
 if(SignalMail) SendMail("[Signal Alert]","["+Symbol()+"] "+DoubleToStr(Bid,Digits)+" Close Buy");
 if(!EachTickMode) BarCount=Bars;
 IsTrade=False;
 continue;
}
//Trailing stop
if(UseTrailingStop && TrailingStop>0) 
{
 if(Bid-OrderOpenPrice()>Point*TrailingStop) 
 {
if(OrderStopLoss()<Bid-Point*TrailingStop) 
{
 OrderModify(OrderTicket(),OrderOpenPrice(),Bid-Point*TrailingStop,OrderTakeProfit(),0,MediumSeaGreen);
 if(!EachTickMode) BarCount=Bars;
 continue;
}
 }
}
 
else {
//Close
 
//+------------------------------------------------------------------+
//| Signal Begin(Exit Sell)  |
//+------------------------------------------------------------------+
 //int IROT = iIchimoku(NULL, 0, 9, 26, 52, MODE_TENKANSEN, Current + 0);
//int IROT1 = iIchimoku(NULL, 0, 9, 26, 52, MODE_TENKANSEN, Current + 1);
//double IBLAU = iIchimoku(NULL, 0, 9, 26, 52, MODE_KIJUNSEN, Current + 0);
//double IA = iIchimoku(NULL, 0, 9, 26, 52, MODE_SENKOUSPANA, Current + 0);
//double IB = iIchimoku(NULL, 0, 9, 26, 52, MODE_SENKOUSPANB, Current + 0);
 
//int BAR0C = iClose(NULL, 0,  0);
//double BAR0O = iOpen(NULL, 0, 0);
//double BAR1C = iClose(NULL, 0,  1);
//double BAR1O = iOpen(NULL, 0, 1);
//double BAR0H = iHigh(NULL, 0,  0);
//double BAR0L = iLow(NULL, 0, 0);
 
//double BAR1H = iHigh(NULL, 0,  1);
//double BAR1L = iLow(NULL, 0, 1);
 
 
 
 //  if ( IA > IB && BAR0C > IA ) Order = SIGNAL_CLOSESELL;
 
 
//+------------------------------------------------------------------+
//| Signal End(Exit Sell)  |
//+------------------------------------------------------------------+
 
if(Order==SIGNAL_CLOSESELL && ((EachTickMode && !TickCheck) || (!EachTickMode && (Bars!=BarCount)))) 
{
 OrderClose(OrderTicket(),OrderLots(),Ask,Slippage,DarkOrange);
 if(SignalMail) SendMail("[Signal Alert]","["+Symbol()+"] "+DoubleToStr(Ask,Digits)+" Close Sell");
 if(!EachTickMode) BarCount=Bars;
 IsTrade=False;
 continue;
}
//Trailing stop
if(UseTrailingStop && TrailingStop>0) 
{
 if((OrderOpenPrice()-Ask)>(Point*TrailingStop)) 
 {
if((OrderStopLoss()>(Ask+Point*TrailingStop)) || (OrderStopLoss()==0)) 
{
 OrderModify(OrderTicket(),OrderOpenPrice(),Ask+Point*TrailingStop,OrderTakeProfit(),0,DarkOrange);
 if(!EachTickMode) BarCount=Bars;
 continue;
}
 }
}
 }
}
 }
 
//+------------------------------------------------------------------+
//| Signal Begin(Entry)  |
//+------------------------------------------------------------------+
 
//int IROT = iIchimoku(NULL, 0, 9, 26, 52, MODE_TENKANSEN, Current + 0);
//int IROT1 = iIchimoku(NULL, 0, 9, 26, 52, MODE_TENKANSEN, Current + 1);
//double IBLAU = iIchimoku(NULL, 0, 9, 26, 52, MODE_KIJUNSEN, Current + 0);
//double IA = iIchimoku(NULL, 0, 9, 26, 52, MODE_SENKOUSPANA, Current + 0);
//double IB = iIchimoku(NULL, 0, 9, 26, 52, MODE_SENKOUSPANB, Current + 0);
 
//int BAR0C = iClose(NULL, 0,  0);
//double BAR0O = iOpen(NULL, 0, 0);
//double BAR1C = iClose(NULL, 0,  1);
//double BAR1O = iOpen(NULL, 0, 1);
//double BAR2O =  iOpen(NULL, 0, 2);
 
 
//double BAR0H = iHigh(NULL, 0,  0);
//double BAR0L = iLow(NULL, 0, 0);
 
//double BAR1H = iHigh(NULL, 0,  1);
//double BAR1L = iLow(NULL, 0, 1);
 
 
 
//if ( BAR1O < BAR1C && BAR2O > BAR2C && BAR3O < BAR3C && (BAR2O - BAR1C < K )) Order = SIGNAL_BUY;
 
//if ( BAR1O > BAR1C && BAR2O < BAR2C && BAR3O < BAR3C && BAR4C < BAR4O ) Order = SIGNAL_BUY;
 
 
//if ( BAR1O > BAR1C && BAR2O < BAR2C && BAR3O > BAR3C &&  ( BAR1C - BAR2O < K)) Order = SIGNAL_SELL;
 
//if ( BAR1O < BAR1C && BAR2O > BAR2C && BAR3O > BAR3C && BAR4C > BAR4O ) Order = SIGNAL_SELL;
 
 
 
//if (IA < IB && (BAR1O - IB < K) && BAR1C > IB && IROT < Ask && BAR1C > IROT1) Order = SIGNAL_BUY;
//if ( (BAR3O < BAR0O) && (BAR2C < BAR0O) &&( BAR1C < BAR0O))  BB = 1;
 
//if ((IBLAU - BAR1C < K)&&(IA - IB < K) && (BAR1O - IB > G) && (BAR1C - IB < K)  && (BAR1O - IB > G)) BB = 1;
if (BAR1C > BAR1O) SS = 1;
if (BAR1C < BAR1O) SS = 1;
 
if(SS == 1)
 Order = SIGNAL_SELL;
 
//+------------------------------------------------------------------+
//| Signal End |
//+------------------------------------------------------------------+
 
//Buy
 if(Order==SIGNAL_BUY && ((EachTickMode && !TickCheck) || (!EachTickMode && (Bars!=BarCount)))) 
 {
 if(!IsTrade  )
{
 //Check free margin
 if(AccountFreeMargin()<(1000*Lots)) 
 {
Print("We have no money. Free Margin = ",AccountFreeMargin());
return(0);
 }
 
 if(UseStopLoss) StopLossLevel=Ask-StopLoss*Point; else StopLossLevel=0.0;
 if(UseTakeProfit) TakeProfitLevel=Ask+TakeProfit*Point; else TakeProfitLevel=0.0;
 
 Ticket=OrderSend(Symbol(),OP_BUY,Lots,Ask,Slippage,StopLossLevel,TakeProfitLevel,"Buy(#"+MagicNumber+")",MagicNumber,0,DodgerBlue);
 if(Ticket>0) 
 {
if(OrderSelect(Ticket,SELECT_BY_TICKET,MODE_TRADES)) 
{
 Print("BUY order opened : ",OrderOpenPrice());
 if(SignalMail) SendMail("[Signal Alert]","["+Symbol()+"] "+DoubleToStr(Ask,Digits)+" Open Buy");
 } else {
 Print("Error opening BUY order : ",GetLastError());
}
 }
 if(EachTickMode) TickCheck = True;
 if(!EachTickMode) BarCount = Bars;
 return(0);
}
 }
 
//Sell
 if(Order==SIGNAL_SELL && ((EachTickMode && !TickCheck) || (!EachTickMode && (Bars!=BarCount)))) 
 {
 if(!IsTrade )
{
 //Check free margin
 if(AccountFreeMargin()<(1000*Lots)) 
 {
Print("We have no money. Free Margin = ",AccountFreeMargin());
return(0);
 }
 
 if(UseStopLoss) StopLossLevel=Bid+StopLoss*Point; else StopLossLevel=0.0;
 if(UseTakeProfit) TakeProfitLevel=Bid-TakeProfit*Point; else TakeProfitLevel=0.0;
 
 Ticket=OrderSend(Symbol(),OP_SELL,Lots,Bid,Slippage,StopLossLevel,TakeProfitLevel,"Sell(#"+MagicNumber+")",MagicNumber,0,DeepPink);
 if(Ticket>0) 
 {
if(OrderSelect(Ticket,SELECT_BY_TICKET,MODE_TRADES)) 
{
 Print("SELL order opened : ",OrderOpenPrice());
 if(SignalMail) SendMail("[Signal Alert]","["+Symbol()+"] "+DoubleToStr(Bid,Digits)+" Open Sell");
if (Notification && Alarm) SendNotification("SELL signal on " + _Symbol);
 } else {
 Print("Error opening SELL order : ",GetLastError());
}
 }
 if(EachTickMode) TickCheck = True;
 if(!EachTickMode) BarCount = Bars;
 return(0);
}
 }
 
 if(!EachTickMode) BarCount=Bars;
 
 return(0);
}
//+------------------------------------------------------------------+


  #31
ONLINE   traderdoc

Sobald die neue Order geöffnet wurde, muss
Alarm = false;
gesetzt werden.

Also z.B.:
...
if(Ticket>0) {
Alarm = false;
...
...
}

traderdoc

Ich erfülle Euch gern Eure EA-, Indikator- und Script-Programmierwünsche.

 




Similar Topics

  Thema Eröffnet von Statistik Letzter Beitrag




0 Benutzer lesen gerade dieses Thema

0 Mitglieder, 0 Gäste, 0 anonyme Nutzer