Metatrader Forum | Forex Expert-Advisor | Broker & Forex Tools

Metatrader Forum | Forex Expert-Advisor | Broker & Forex Tools (http://www.expert-advisor.com/forum/index.php)
-   Programmierung MQL4 (http://www.expert-advisor.com/forum/forumdisplay.php?f=220)
-   -   Programmierung eines EA's - Pro Bar nur ein Trade (http://www.expert-advisor.com/forum/showthread.php?t=3618)

Tradox 10.04.14 18:58

Programmierung eines EA's - Pro Bar nur ein Trade
 
Hallo Zusammen,

das ist mein erster Beitrag als Neuling in diesem Forum. Deswegen hoffe ich auch alle Regeln mit diesem Beitrag beachtet zu haben.

Ich bin schon eine längere Zeit am Suchen einer Programmierung.
Der EA soll je einer Bar nur einen Trade eröffnen. Das heißt, wenn ich einen EA im 1 Std. Chart starte, soll er nicht "1000" Neue Trades eröffnen, da der vorherige Trade jeweils in den Stop Loss gelaufen ist.

Ich habe hier einen Ausschnitt von einem EA Beispiel und hoffe jemand kann mir eine Änderung vorzeigen, was die obige Bedingung erfüllt und freue mich über positive Antworten!

Viele Grüße :)

Tradox

------------------------------------------------

int BarCount;
int Current;
bool TickCheck = 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;

pako 10.04.14 22:35

Code:

//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
bool NewBar=false;
//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
int start()
  {
  FunNewBar();
  if(NewBar)
    {
    }
  return(0);
  }
//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
void FunNewBar()
  {
  static datetime NewTime=0;
  NewBar=false;
  if(NewTime!=Time[0])
    {
      NewTime=Time[0];
      NewBar=true;
    }
  }
//+------------------------------------------------------------------+



Alle Zeitangaben in WEZ +1. Es ist jetzt 13:17 Uhr.

Powered by vBulletin® Version 3.8.5 (Deutsch)
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.6.1
Powered by vBCMS® 2.7.0 ©2002 - 2024 vbdesigns.de
Copyright ©2009 - 2023 by Expert-Advisor.com - Das Metatrader Forum