schnuky
#property strict
#include <Arrays/ArrayInt.mqh>
input double Lots = 0.01;
input int GridPoints = 300;
input int TpPoints = 400; //TP Punkte
input int SlPoints = 0; //SL Punkte
input string Commentary = ""; //Kommentar
input int Magic = 1; //Magic Nummer
CArrayInt ticketsBuy;
CArrayInt ticketsSell;
double totalLotsBuy = 0;
double totalLotsSell = 0;
int OnInit() {
return(INIT_SUCCEEDED);
}
void OnDeinit(const int reason){
}
void OnTick(){
if(ticketsBuy.Total() == 0){
executeBuy();
}else if(OrderSelect(ticketsBuy.At(ticketsBuy.Total()-1) ,SELECT_BY_TICKET)){
if(OrderCloseTime() > 0) ticketsBuy.Delete(ticketsBuy.Total()-1);
else if(Bid < OrderOpenPrice() - GridPoints * _Point){
executeBuy();
double bePrice = calcBePrice(ticketsBuy);
double tp = 0;
switch(ticketsBuy.Total()){
case 2: tp = bePrice + TpPoints * _Point / (totalLotsBuy / Lots); break;
case 3: tp = bePrice + TpPoints * _Point / (totalLotsBuy / Lots) / 2; break;
case 4: tp = bePrice + TpPoints * _Point / (totalLotsBuy / Lots) / 4; break;
default: tp = bePrice;
}
adjustTargetAndStop(ticketsBuy,tp);
}
}
if(ticketsSell.Total() == 0){
executeSell();
}else if(OrderSelect(ticketsSell.At(ticketsSell.Total()-1),SELECT_BY_TICKET)){
- This is my first EA and I'm trying to apply hedging and martingale strategy. Help anyone;)
- help for this code
- Wer kann helfen...bin neu hier.