Free Neural Netzwerk Forex Handel


Neuronale Netze Prognose Profite. Neurale Netzwerke sind state-of-the-art, trainierbare Algorithmen, die bestimmte wichtige Aspekte in der Funktionsweise des menschlichen Gehirns emulieren Dies gibt ihnen eine einzigartige, Selbst-Training Fähigkeit, die Fähigkeit, nicht klassifiziert Informationen und die meisten zu formalisieren Wichtig ist die Fähigkeit, Prognosen zu erstellen, die auf den historischen Informationen basieren, die sie zur Verfügung haben. Neurale Netzwerke wurden zunehmend in einer Vielzahl von Geschäftsanwendungen eingesetzt, einschließlich Prognose und Marketing-Forschungslösungen In einigen Bereichen wie Betrugserkennung oder Risikobewertung sind sie Die unbestreitbaren Führer Die wichtigsten Bereiche, in denen neuronale Netze gefunden haben, sind Finanzoperationen, Unternehmensplanung, Handel, Business Analytics und Produktpflege Neuronale Netze können von allen Arten von Händlern erbracht werden, also wenn Sie ein Händler und Sie Port noch nicht Wurde in neuronale Netze eingeführt, wir führen Sie durch diese Methode der technischen Analyse und zeigen Ihnen, wie man ein Pflegen Sie es zu Ihrem Trading Stylemon Delusions Die meisten Menschen haben noch nie von neuronalen Netzwerken gehört, und wenn sie aren t Trader sind, müssen sie wahrscheinlich nicht wissen, was sie sind Was ist wirklich überraschend, aber ist die Tatsache, dass eine riesige Anzahl von denen, die Profitieren reich von neuronalen Netzwerk-Technologie haben noch nie davon gehört, nehmen Sie es für eine hohe wissenschaftliche Idee oder denken Sie daran, wie von einem glatten Marketing-Gimmick Es gibt auch diejenigen, die alle ihre Hoffnungen auf neuronale Netze, lionisieren die Netze nach einigen positiven Erfahrung mit ihnen und in Bezug auf sie als eine Silber-Kugel-Lösung für jede Art von Problem Allerdings, wie jede Handelsstrategie neuronale Netze sind keine schnell-fix, die es Ihnen erlauben, es reich zu schlagen, indem Sie auf eine Schaltfläche oder zwei In der Tat, das richtige Verständnis Von neuronalen Netzen und deren Zweck ist entscheidend für ihre erfolgreiche Anwendung Sowohl im Handel als auch im Handel sind neuronale Netze eine neue, einzigartige Methode der technischen Analyse, die für diejenigen gedacht ist, die einen Denkansatz annehmen Ihr Geschäft und sind bereit, einige Zeit und Mühe zu machen, um diese Methode für sie zu arbeiten Best of all, wenn richtig angewendet, neuronale Netze können einen Gewinn auf einer regelmäßigen Basis bringen Neuronale Netze, um Chancen zu entdecken Ein großes Missverständnis ist, dass viele Händler Fehler Neuronale Netze für ein Prognosewerkzeug, die Ratschläge geben können, wie man in einer bestimmten Marktsituation agieren kann Neuronale Netze machen keine Prognosen Stattdessen analysieren sie Preisdaten und entdecken Chancen Mit einem neuronalen Netzwerk können Sie eine Handelsentscheidung treffen, die auf gründlich analysiert basiert Daten, die bei der Verwendung von traditionellen technischen Analysemethoden nicht unbedingt der Fall sind. Für einen ernsthaften, denkenden Händler sind neuronale Netze ein Werkzeug der nächsten Generation mit großem Potenzial, das subtile nichtlineare Interdependenzen und Muster erkennen kann, die andere Methoden der technischen Analyse nicht in der Lage sind Zu entdecken. Die besten Netze Genau wie jede Art von großartigen Produkt oder Technologie, neuronale Netze haben angefangen, al L diejenigen, die auf der Suche nach einem knospen Markt Torrents von Anzeigen über die nächste Generation Software haben die Markt-Anzeigen feiern die mächtigsten aller neuronalen Netzwerk-Algorithmen jemals erstellt Selbst in den seltenen Fällen, wenn Werbung Ansprüche ähneln die Wahrheit, im Auge behalten Dass eine 10 Steigerung der Effizienz wahrscheinlich die meisten ist, die Sie jemals aus einem neuronalen Netzwerk bekommen werden. Mit anderen Worten, es macht keine wunderbaren Renditen und unabhängig davon, wie gut es in einer bestimmten Situation funktioniert, gibt es einige Datensätze und Aufgabenklassen für Die die bisher verwendeten Algorithmen überlegen bleiben Denken Sie daran, dies ist nicht der Algorithmus, der den Trick macht Gut vorbereiteten Input-Informationen über die Ziel-Indikator ist die wichtigste Komponente Ihres Erfolgs mit neuronalen Netzwerken ist schneller Konvergenz Besser Viele von denen, die bereits neuronale Netze verwenden Versehentlich glauben, dass je schneller ihr Netz liefert Ergebnisse, desto besser ist dies Dies ist jedoch eine Täuschung Ein gutes Netzwerk ist nicht bestimmt b Y die Rate, mit der es Ergebnisse produziert und die Benutzer müssen lernen, die beste Balance zwischen der Geschwindigkeit, bei der das Netzwerk trainiert und die Qualität der Ergebnisse, die es produziert zu finden. Korrekte Anwendung von neuronalen Netzen Viele Händler gelten neuronale Netze falsch, weil sie zu viel platzieren Vertrauen in die Software, die sie alle verwenden, ohne dass sie mit ordnungsgemäßen Anweisungen versehen wurden, wie man sie richtig benutzt Um ein neuronales Netzwerk zu benutzen, ist der richtige Weg und damit erfreulich ein Trader auf alle Stufen des Netzwerkvorbereitungszyklus zu achten Ist der Händler und nicht sein Netz, das dafür verantwortlich ist, eine Idee zu erfinden, diese Idee zu formalisieren, zu testen und zu verbessern, und schließlich den richtigen Moment zu wählen, um es zu entsorgen, wenn es nicht mehr nützlich ist. Betrachten wir die Stufen von Dieser entscheidende Prozess in mehr Detail.1 Finden und Formalisieren einer Handelsidee Ein Händler sollte vollständig verstehen, dass sein oder ihr neuronales Netzwerk nicht für die Erarbeitung von gewinnenden Handel Ideen und Konzepte bestimmt ist Es ist Für die Bereitstellung der vertrauenswürdigsten und präzisen Informationen möglich, wie effektiv Ihre Trading Idee oder Konzept ist daher sollten Sie kommen mit einer ursprünglichen Trading-Idee und klar definieren den Zweck dieser Idee und was Sie erwarten, zu erreichen, indem sie es Dies ist die Wichtigste Stufe im Netzwerkvorbereitungszyklus Für verwandte Lesung siehe Lektionen aus einem Trader s Tagebuch 2 Verbesserung der Parameter Ihres Modells Als nächstes sollten Sie versuchen, die Gesamtmodellqualität zu verbessern, indem Sie den verwendeten Datensatz ändern und die verschiedenen Parameter anpassen. Abbildung 1 Festlegung des Optimierungsalgorithmus und seiner Eigenschaften.3 Entsorgung des Modells Wenn es veraltet wird Jedes neuronale Netzwerk basierte Modell hat eine Lebensdauer und kann nicht unendlich verwendet werden Die Langlebigkeit der Lebensdauer eines Modells hängt von der Marktsituation und von wie ab Lange die Marktinterdependenzen, die sich in ihr widerspiegeln, bleiben aktuell. Doch früher oder später wird jedes Modell obsolet Wenn dies geschieht, können Sie entweder r Etrain das Modell mit völlig neuen Daten, dh ersetzen Sie alle Daten, die verwendet wurden, fügen Sie einige neue Daten in den vorhandenen Datensatz und trainieren Sie das Modell wieder, oder einfach das Modell ganz in Rente gehen. Viele Händler machen den Fehler, nach dem einfachsten Weg - Sie verlassen sich stark auf und nutzen den Ansatz, für die ihre Software bietet die meisten benutzerfreundliche und automatisierte Funktionalität Diese einfachste Ansatz prognostiziert einen Preis ein paar Bars vor und basiert Ihr Trading-System auf diese Prognose Andere Händler prognostizieren Preisänderung oder Prozentsatz des Preises Veränderung Dieser Ansatz liefert selten bessere Ergebnisse als die Prognose des Preises direkt Sowohl die vereinfachten Ansätze versagen, die meisten längerfristigen Interdependenzen aufzudecken und zu nutzen und das Modell wird schnell veraltet, während sich die globalen Triebkräfte ändern Optimaler Gesamtansatz für die Verwendung von neuronalen Netzwerken Ein erfolgreicher Trader wird sich konzentrieren und viel Zeit damit verbringen, das Regieren zu wählen Eingangspositionen für sein neuronales Netzwerk und Anpassung ihrer Parameter Er oder sie wird aus mindestens einigen Wochen - und manchmal bis zu mehreren Monaten - den Einsatz des Netzwerks ausgeben. Ein erfolgreicher Trader wird auch sein Netz an die sich ändernden Bedingungen während seines gesamten Lebens anpassen Span Weil jedes neuronale Netzwerk nur einen relativ kleinen Marktteilnehmer abdecken kann, sollten auch neuronale Netze in einem Komitee eingesetzt werden. So viele neuronale Netzwerke verwenden wie möglich - die Fähigkeit, mehrere auf einmal zu nutzen, ist ein weiterer Vorteil dieser Strategie. Jedes dieser Mehrfachnetze kann für irgendeinen spezifischen Aspekt des Marktes verantwortlich sein und Ihnen einen großen Vorteil auf der ganzen Linie geben. Jedoch wird empfohlen, dass Sie die Zahl der Netze behalten, die Sie innerhalb des Bereichs von fünf bis 10 verwenden, schließlich neuronale Netze Sollte mit einem der klassischen Ansätze kombiniert werden Dies ermöglicht es Ihnen, die Ergebnisse, die in Übereinstimmung mit Ihren Handelspräferenzen erreicht werden, besser zu nutzen. Schlussfolgerung Sie werden es erleben Erleben Sie echten Erfolg mit neuronalen Netzen nur, wenn Sie aufhören, das beste Netz zu suchen. Schließlich liegt der Schlüssel zu Ihrem Erfolg mit neuronalen Netzwerken nicht im Netzwerk selbst, sondern in Ihrer Handelsstrategie Deshalb, um eine profitable Strategie zu finden, die für Sie arbeitet, Sie müssen eine starke Idee entwickeln, wie man ein Komitee von neuronalen Netzen zu schaffen und sie in Kombination mit klassischen Filtern und Geld-Management-Regeln. Für verwandte Lesung, check out Neural Trading Biological Keys zu Profit und die Trading Systems Coding Tutorial. Licensed User Center. Trade mit Intelligenz mit TradingSolutions. TradingSolutions kombiniert technische Analyse mit künstlichen Intelligenz-AI-Technologien mit neuronalen Netzwerken und genetischen Algorithmen, um Muster aus historischen Daten zu erlernen und Systemparameter zu optimieren Diese Handelssoftware arbeitet mit Aktien, Futures, Währungen FOREX und vielen anderen Finanzinstrumenten Bauen auch Systeme für US - und internationale Märkte. Mehr als 300 der beliebtesten tec Hnical Indikatoren. Proven Probe und Kundenleistung. Industrie führende Datenunterstützung von eSignal Interactive Brokers und vieles mehr. Proprietary Optimal Signal technology. Free Technical Support.100 Free Systems und vorgefertigte neuronale Netzwerk-Modelle. Free Abonnement zu Trader68 Standard automatisierte Trading-Software. Erfolgreich in über 66 Ländern auf der ganzen Welt eingesetzt.30-Tage Geld-zurück-Garantie. Lizenzierte User Center. Trade mit Intelligenz mit TradingSolutions. TradingSolutions kombiniert technische Analyse mit künstlichen Intelligenz AI-Technologien mit neuronalen Netzwerken und genetischen Algorithmen, um Muster aus historischen Daten zu lernen und zu optimieren System-Parameter Diese Trading-Software arbeitet mit Aktien, Futures, Währungen FOREX und viele andere Finanzinstrumente Es kann auch Systeme für US-und internationalen Märkten. Unter 300 der beliebtesten technischen Indikatoren. Proven Probe und Kundenleistung. Industrie führende Datenunterstützung von eSignal Interaktive Broker und vieles mehr. Proprietary Optimale Signal-Technologie. Free Technical Support.100 Free Systems und vorgefertigte neuronale Netzwerk-Modelle. Sehrlich in über 66 Ländern auf der ganzen Welt verwendet.30-Tage Geld-zurück-Garantie. Hybrid Neuronale Netzwerk Stop-and-Reverse-Strategien für Forex. Von Michael R Bryant. Neurale Netzwerke wurden in Handelssystemen seit vielen Jahren mit unterschiedlichem Erfolg eingesetzt. Ihre primäre Anziehungskraft ist, dass ihre nichtlineare Struktur besser in der Lage ist, die Komplexität der Preisbewegung zu erfassen, als Standard, Indikator-basierte Handelsregeln Einer der Kritik ist, dass neuronale netzwerkbasierte Handelsstrategien eher übertrieben werden und daher nicht auf neue Daten gut reagieren. Eine mögliche Lösung für dieses Problem besteht darin, neuronale Netze mit einer regelbasierten Strategielogik zu kombinieren, um eine hybride Strategie zu schaffen Artikel wird zeigen, wie dies mit Adaptrade Builder durchgeführt werden kann. Insbesondere wird dieser Artikel veranschaulichen die folgenden bination neuronale Netzwerk-und Regel-basierte Logik für Handelseinträge . Ein Drei-Segment-Datenansatz wird verwendet, wobei das dritte Segment zur Validierung der endgültigen Strategien verwendet wird. Der daraus resultierende Strategiecode für MetaTrader 4 und TradeStation wird gezeigt, und es wird gezeigt, dass die Validierungsergebnisse für jede Plattform positiv sind. Neuronale Netze als Trade Entry Filters. Mathematisch ist ein neuronales Netzwerk eine nichtlineare Kombination aus einem oder mehreren gewichteten Inputs, die einen oder mehrere Ausgabewerte generiert. Für den Handel wird ein neuronales Netzwerk im Allgemeinen auf eine von zwei Weisen 1 als Vorhersage des zukünftigen Preises verwendet Bewegung oder 2 als Indikator oder Filter für den Handel Hier wird seine Verwendung als Indikator oder Handelsfilter betrachtet. Als Indikator gilt ein Neuronales Netzwerk als zusätzliche Bedingung oder Filter, die erfüllt sein muss, bevor ein Handel eingegeben werden kann Inputs in das Netzwerk sind in der Regel andere technische Indikatoren wie Impuls, Stochastik, ADX, gleitende Durchschnitte, und so weiter, sowie Preise und Kombinationen der vorangegangenen Die Eingänge sind skaliert Und das neuronale Netzwerk ist so ausgelegt, dass der Ausgang ein Wert zwischen -1 und 1 ist. Ein Ansatz besteht darin, einen langen Eintrag zuzulassen, wenn der Ausgang größer oder gleich einem Schwellenwert ist, wie z. B. 0 5 und ein kurzer Eintrag, wenn der Ausgabe ist kleiner oder gleich dem Negativ der Schwelle zB -0 5 Diese Bedingung wäre zusätzlich zu den vorhandenen Eintrittsbedingungen. Wenn es zum Beispiel eine lange Einstiegsbedingung gab, müsste es wahr sein und die neuronale Netzausgabe wäre Muss mindestens gleich dem Schwellenwert für einen langen Eintrag sein. Bei der Einrichtung eines neuronalen Netzes wäre ein Trader typischerweise für die Auswahl der Eingänge und der Netzwerktopologie und für das Training des Netzes verantwortlich, das die optimalen Gewichtswerte bestimmt Wird unten angezeigt, Adaptrade Builder führt diese Schritte automatisch als Teil des evolutionären Buildprozesses durch, auf dem die Software basiert. Verwenden Sie das neuronale Netzwerk als Handelsfilter, damit es leicht mit anderen Regeln kombiniert werden kann, um ein Hybrid-Tradin zu erstellen G-Strategie, die die besten Eigenschaften traditioneller, regelbasierter Ansätze mit den Vorteilen der neuronalen Netze kombiniert. Als einfaches Beispiel könnte Builder eine gleitende durchschnittliche Crossover-Regel mit einem neuronalen Netzwerk kombinieren, so dass eine lange Position bei der schnellen Bewegung stattfindet Durchschnittliche Kreuze über dem langsamen gleitenden Durchschnitt und die neuronale Netzausgabe an oder über seinem Schwellenwert. Stop-and-Reverse Trading Strategies. A Stop-und-Reverse-Trading-Strategie ist eine, die immer auf dem Markt ist, entweder lange oder kurz Streng genommen , Stop-and-Reverse bedeutet, dass Sie den Handel umkehren, wenn Ihr Stop-Order getroffen wird. Allerdings benutze ich es als Short-Hand für jede Trading-Strategie, die von lang nach kurz zu lang und so weiter rückgängig macht, so dass Sie immer wieder in Der Markt Durch diese Definition ist es nicht notwendig für die Aufträge, um Stopp-Aufträge Sie könnten eingeben und rückgängig mit Markt oder Limit Orders auch Es ist auch nicht notwendig, dass jede Seite die gleiche Logik oder sogar die gleiche Reihenfolge Typ verwenden Zum Beispiel, du könntest Geben Sie lange ein und beenden Sie kurz bei einem Stoppauftrag und geben Sie kurz ein und verlassen Sie sich lange auf einer Marktreihenfolge mit unterschiedlichen Regeln und Bedingungen für jeden Einstieg. Dies wäre ein Beispiel für eine asymmetrische Stop-and-Reverse-Strategie. Der primäre Vorteil eines Stopps - und-reverse-Strategie ist, dass immer immer auf dem Markt, Sie nie verpassen keine großen Moves Ein weiterer Vorteil ist Einfachheit Wenn es separate Regeln und Bedingungen für die Eingabe und Verlassen Trades gibt es mehr Komplexität und mehr, die schief gehen kann Kombination von Einträgen und Ausgänge bedeutet, dass weniger zeitliche Entscheidungen getroffen werden müssen, was weniger Fehler bedeuten kann. Auf der anderen Seite kann man argumentieren, dass die besten Voraussetzungen für die Beendigung eines Handels nur selten die gleichen sind, wie man in die entgegengesetzte Richtung eintritt, die in den Handel eintritt Sind inhärent getrennte Entscheidungen, die daher separate Regeln und Logik einsetzen sollten. Ein weiterer potenzieller Nachteil, immer auf dem Markt zu sein, ist, dass die Strategie durch jede Eröffnungslücke handeln wird Eingehende Lücke gegen die Position kann bedeuten, einen großen Verlust, bevor die Strategie in der Lage ist, um Strategien, die eingegeben und verlassen selektiv umzukehren, oder dass Ausstieg am Ende des Tages kann die Auswirkungen der Öffnung Lücken zu minimieren. Seit das Ziel ist es, eine Forex-Strategie zu bauen , MetaTrader 4 MT4 ist eine offensichtliche Wahl für die Handelsplattform, da MetaTrader 4 in erster Linie für Forex konzipiert ist und weit verbreitet für den Handel dieser Märkte verwendet wird, zum Beispiel, MetaTrader vs TradeStation A Sprachvergleich Doch in den letzten Jahren hat TradeStation die Forex-Märkte viel aggressiver Abhängig von Ihrem Handelsvolumen und / oder Konto-Ebene ist es möglich, die Devisenmärkte durch TradeStation zu handeln, ohne irgendwelche Plattformgebühren zu verursachen oder irgendwelche Provisionen zu bezahlen Spreads sind angeblich engen mit guter Liquidität auf den großen Forex-Paaren Aus diesen Gründen, Beide Plattformen wurden für dieses Projekt gezielt. Several Probleme entstehen bei der Ausrichtung mehrerer Plattformen gleichzeitig Zuerst können die Daten diff sein Auf unterschiedlichen Plattformen, mit Unterschieden in Zeitzonen, Preisangaben für einige Takte, Volumen und verfügbare Datumsbereiche Um diese Unterschiede zu verkleinern, wurden Daten von beiden Plattformen erhalten und die Strategien wurden über beide Datenreihen gleichzeitig gebaut. Die besten Strategien waren Also die, die bei allen Datenreihen trotz aller Unterschiede in den Daten gut funktionierten. Die im Builder verwendeten Dateneinstellungen sind nachfolgend in Abb. 1 dargestellt. Wie aus der Marktdaten-Tabelle in der Abbildung abgeleitet werden kann, wurde der Euro-Dollar-Devisenmarkt auf EURUSD gerichtet Mit einer Stabgröße von 4 Stunden 240 Minuten Andere Stabgrößen oder - märkte hätten genauso gut gedient, ich konnte nur so viele Daten über meine MT4-Plattform erhalten, wie durch den in Fig. 1 Datenreihe 2 dargestellten Datumsbereich angegeben Datumsbereich wurde bei der Erlangung der äquivalenten Datenreihe aus der TradeStation Datenreihe 1 80 der Daten verwendet für den Bau kombiniert in-Probe und out-of-Probe, mit 20 6 20 14 bis 2 10 15 beiseite für valida Die 80er-Sekunde 80 wurde dann in die Probe gesetzt, wobei 20 auf die Probe eingestellt wurde, wie in Fig. 1 gezeigt. Die Gebotsanforderung wurde auf 5 Pips eingestellt und die Handelskosten von 6 Pips oder 60 pro Vollgröße Es wurden 100.000 Aktien pro Umdrehung angenommen. Beide Datenreihen wurden in den Build aufgenommen, wie durch die Häkchen in der linken Spalte der Marktdaten-Tabelle angegeben. Abbildung 1 Marktdaten-Einstellungen für den Aufbau einer Forex-Strategie für MetaTrader 4 und TradeStation. Ein anderes potenzielles Problem bei der Ausrichtung auf mehrere Plattformen ist, dass Builder entworfen ist, um die Art und Weise, wie jede unterstützte Plattform ihre Indikatoren berechnet, zu duplizieren, was bedeutet, dass die Indikatorwerte unterschiedlich sein werden, je nachdem, welche Plattform ausgewählt wird. Um diese mögliche Quelle der Diskrepanz zu vermeiden, können alle Indikatoren Die in MetaTrader 4 anders auswerten als in TradeStation, sollten aus dem Build eliminiert werden, was bedeutet, dass die folgenden Indikatoren vermieden werden sollen. Alle anderen Indikatoren, die für beide Plattformen verfügbar sind, werden berechnet D die gleiche Weise in beiden Plattformen TradeStation umfasst alle Indikatoren, die in Builder verfügbar sind, während MetaTrader 4 nicht darum, um nur Indikatoren einzuschließen, die in beiden Plattformen verfügbar sind, sollte die MetaTrader 4-Plattform als Codetyp im Builder ausgewählt werden Das entfernt automatisch alle Indikatoren aus dem Build-Set, die für MT4 nicht verfügbar sind, wodurch die Indikatoren, die in beiden Plattformen verfügbar sind, verlassen werden. Da ich jedoch Unterschiede in den Lautstärke-Daten aus jeder Plattform festgestellt habe, habe ich alle volumenabhängigen Indikatoren entfernt Aus dem Build-Set Schließlich wurde der Tageszeit-Indikator wegen der Unterschiede in den Zeitzonen zwischen den Datendateien entfernt. In Abb. 2 unten wird die Liste der Indikatoren angezeigt, die im Build-Set verwendet werden, sortiert nach, ob der Indikator vorhanden ist oder nicht Wurde von der Build-Prozedur betrachtet Sperre Die Indikatoren, die aus den oben erwähnten Gründen aus den oben genannten Gründen entfernt wurden, werden am Anfang der Liste angezeigt. Die verbleibende Angabe Ors, beginnend mit Simple Mov Ave, waren alle Teil der Build-Set. Figure 2 Indikator-Selektionen im Builder, wobei die Indikatoren aus dem Build-Set entfernt wurden. Die Auswertungsoptionen, die im Build-Prozess verwendet werden, sind in Abb. 3 dargestellt. Wie bereits erwähnt, ist MetaTrader 4 Wurde als Codeauswahl ausgewählt. Nachdem Strategien im Builder erstellt wurden, können beliebige Optionen auf der Registerkarte Auswertungsoptionen einschließlich des Codetyps geändert und die Strategien neu ausgewertet werden, wodurch auch der Code in welcher Sprache ausgewählt wird Diese Funktion wurde verwendet, um den TradeStation-Code für die endgültige Strategie zu erhalten, nachdem die Strategien für MetaTrader 4.Figure 3 Evaluierungsoptionen im Builder für die EURUSD-Forex-Strategie gebaut wurden. Um Stop-and-Reverse-Strategien zu schaffen, wurden alle Exit-Typen aus dem Build-Set, wie unten in Abb. 4 gezeigt. Alle drei Arten von Eintragsaufträgen - Markt, Stop und Limit - wurden als zu prüfen, was bedeutet, dass der Build-Prozess könnte jeder von ihnen während der Build-Prozess. Figu Re 4 Auftragsarten, die im Builder ausgewählt wurden, um eine Stop-and-Reverse-Strategie zu erstellen. Die Builder-Software generiert automatisch regelbasierte logische Bedingungen für die Eingabe und oder den Ausstieg Um der Strategie ein neuronales Netzwerk hinzuzufügen, ist es nur notwendig, die Option Include auszuwählen Ein neuronales Netzwerk in den Eintrittsbedingungen auf der Registerkarte Strategy Options, wie unten in Abb. 5 gezeigt. Die neuronalen Netzwerkeinstellungen wurden bei ihren Vorgaben belassen. Im Rahmen der Stop-and-Reverse-Logik wurde die Option Market Sides auf Long Short gesetzt und die Option zum Warten auf Beenden vor dem Eintritt in den neuen Handel wurde deaktiviert Letzteres ist notwendig, um den Eintrag zu aktivieren, um die aktuelle Position bei einer Umkehr zu beenden. Alle anderen Einstellungen wurden bei den Standardeinstellungen hinterlassen. Figure 5 Strategieoptionen, die im Builder ausgewählt wurden, um eine Hybridstrategie zu erstellen Sowohl regelbasierte als auch neuronale Netzwerkbedingungen. Die evolutionäre Natur des Buildprozesses im Builder orientiert sich an der Fitness, die aus den Zielen und Bedingungen berechnet wird, die auf der Registerkarte Metriken definiert sind Wn unten in Abb. 6 Die Build-Ziele wurden einfach gehalten, den Nettogewinn zu maximieren und gleichzeitig die Komplexität zu minimieren, die ein geringes Gewicht im Verhältnis zum Nettogewinn erhielt. Mehr Aufmerksamkeit wurde auf die Baubedingungen gelegt, die den Korrelationskoeffizienten und die Bedeutung für die allgemeine Strategie beinhalteten Qualität, sowie die durchschnittlichen Bars in Trades und die Anzahl der Trades. Zunächst wurden nur die durchschnittlichen Bars in Trades als Build-Zustand enthalten. Allerdings in einigen der frühen Builds wurde der Nettogewinn über die Handelslänge begünstigt, So dass die Anzahl der Trades metric hinzugefügt wurde Der angegebene Bereich für die Anzahl der Trades zwischen 209 und 418 entspricht den durchschnittlichen Handelslängen zwischen 15 und 30 bar, basierend auf der Anzahl der Balken in der Buildperiode. Dadurch wird das Metrik hinzugefügt Legte mehr Wert auf das Handelslängenziel, das zu mehr Mitgliedern der Bevölkerung mit dem gewünschten Umfang der Handelslängen führte. Bild 6 Ziele und Bedingungen, die auf der Registerkarte Metriken festgelegt sind, bestimmen E, wie die Fitness berechnet wird. Die Bedingungen für die Auswahl der Top-Strategien duplizieren die Build-Bedingungen, außer dass die Top-Strategien Bedingungen über den gesamten Datenbereich ausgewertet werden, einschließlich des Validierungssegments, das getrennt ist, und nicht nur über die Buildperiode, als Ist der Fall für die Build-Bedingungen Die Top-Strategien Bedingungen werden von dem Programm verwendet, um alle Strategien, die alle Bedingungen in einer separaten Population zu beiseite legen. Die endgültigen Einstellungen sind auf der Registerkarte Build Options, wie unten in Abb. 7 am meisten Wichtige Optionen hierbei sind die Bevölkerungsgröße, die Anzahl der Generationen und die Möglichkeit, auf der Grundlage der Out-of-Sample-Performance zurückzusetzen. Die Populationsgröße wurde so gewählt, dass sie groß genug ist, um eine gute Vielfalt in der Bevölkerung zu erhalten, während sie noch klein genug ist, um einzubauen Eine angemessene Zeitspanne Die Anzahl der Generationen basierte darauf, wie lange es dauert, bis ein paar vorläufige Builds für die Ergebnisse zu konvergieren. Figure 7 Build Optionen inc Lautet die Populationsgröße, die Anzahl der Generationen und die Optionen für das Zurücksetzen der Population auf der Grundlage der Out-of-Sample-Performance. Die Option zum Zurücksetzen auf Out-of-Sample OOS Performance startet den Build-Prozess über die angegebene Anzahl von Generationen, wenn die angegebene Bedingung wird in diesem Fall erfüllt, wird die Bevölkerung zurückgesetzt werden, wenn der Out-of-Sample-Nettogewinn weniger als 20.000 ist Dieser Wert wurde auf der Grundlage von Vorversuchen gewählt, um ein hoch genug Wert zu sein, dass es wahrscheinlich nicht erreicht werden würde. Der Build-Prozess wurde alle 30 Generationen wiederholt, bis manuell gestoppt wurde Dies ist ein Weg, um das Programm identifizieren Strategien auf der Grundlage der Top-Strategien Bedingungen über einen längeren Zeitraum Periodisch kann die Top-Strategien Bevölkerung überprüft werden und der Build-Prozess abgebrochen, wenn geeignete Strategien Sind gefunden. Notice, dass ich out-of-Probe in Anführungszeichen Wenn die out-of-Sample-Zeitraum verwendet wird, um die Bevölkerung auf diese Weise zurückzusetzen, ist die Out-of-Sample-Zeitraum nicht mehr wirklich out-of - sample Da diese Periode jetzt verwendet wird, um den Build-Prozess zu führen, ist es effektiv Teil der In-Sample-Periode. Deshalb ist es ratsam, ein drittes Segment für die Validierung beiseite zu legen, wie es oben diskutiert wurde. Nach mehreren Stunden der Verarbeitung Und eine Reihe von automatischen Umbauten wurde in der Top-Strategien-Population eine geeignete Strategie gefunden. Die geschlossene Handels-Aktienkurve ist unten in Abb. 8 dargestellt. Die Eigenkapitalkurve zeigt eine konsistente Performance in beiden Datensegmenten mit einer ausreichenden Anzahl von Trades und im Wesentlichen den gleichen Ergebnissen Beide Datenreihen. Figure 8 Closed-Trade-Equity-Kurve für die EURUSD-Stop-and-Reverse-Strategie. Um die Strategie über den Validierungszeitraum zu überprüfen, wurde das Datumssteuerelement auf der Registerkarte Markets siehe Abb. 1 zum Enddatum der Daten 2 geändert 11 2015, und die Strategie wurde neu ausgewertet, indem man den Befehl Evaluate aus dem Menü Strategie im Builder auswählte. Die Ergebnisse sind unten in Abb. 9 dargestellt. Die Validierungsergebnisse in der roten Box zeigen, dass die Strategie Hielt sich an Daten, die während des Build-Prozesses nicht verwendet wurden. Abbildung 9 Closed-Trade-Equity-Kurve für die EURUSD-Stop-and-Reverse-Strategie einschließlich des Validierungszeitraums. Die endgültige Überprüfung ist zu sehen, wie die Strategie auf jeder Datenreihe separat mit dem Code Ausgabe Option für diese Plattform Dies ist notwendig, weil, wie oben erklärt, kann es Unterschiede in den Ergebnissen je nach 1 der Code-Typ, und 2 die Daten-Serie Wir müssen überprüfen, dass die gewählten Einstellungen minimiert diese Unterschiede, wie beabsichtigt zu testen Die Strategie für MetaTrader 4, die Datenreihe von TradeStation wurde auf der Registerkarte Märkte abgewählt und die Strategie wurde neu bewertet. Die Ergebnisse sind unten in Abb. 10 dargestellt, die die untere Kurve in Abb. 9 dupliziert. Abbildung 10 Handelskurve des Handels Für die EURUSD-Stop-and-Reverse-Strategie, einschließlich der Validierungsperiode, für MetaTrader 4.Finally, um die Strategie für TradeStation zu testen, wurde die Datenreihe von TradeStation ausgewählt und die Serie für MetaTrader 4 war das Auf die Registerkarte Märkte geleitet, wurde die Codeausgabe in die TradeStation geändert und die Strategie wurde neu ausgewertet. Die Ergebnisse sind unten in Fig. 11 gezeigt und scheinen der mittleren Kurve in Fig. 9 sehr ähnlich zu sein, wie erwartet. Figur 11 Closed - Handels-Aktienkurve für die EURUSD-Stop-and-Reverse-Strategie einschließlich des Validierungszeitraums für die TradeStation. Der Code für beide Plattformen ist unten in Abb. 12 dargestellt. Klicken Sie auf das Bild, um die Code-Datei für die entsprechende Plattform zu öffnen Regelbasierter Teil der Strategie nutzt unterschiedliche volatilitätsbedingte Bedingungen für die langen und kurzen Seiten Die neuronalen Netzeingänge bestehen aus einer Vielzahl von Indikatoren, darunter Tag der Woche, Trend ZLTrend, Intraday High, Oszillatoren InvFisherCycle, InvFisherRSI, Bollinger Bands Und Standardabweichung. Die Hybrid-Art der Strategie kann direkt in der Code-Anweisung aus dem TradeStation-Code gesehen werden. Wenn EntCondL und NNOutput 0 5 dann beginnen Buy EnMark-L NShares Aktien nächsten Bar auf dem Markt. Die Variable EntCondL repräsentiert die regelbasierten Einstiegsbedingungen und NNOuput ist die Ausgabe des neuronalen Netzes Beide Bedingungen müssen wahr sein, um den langen Eintrag zu platzieren Der kurze Eintragszustand funktioniert auf die gleiche Weise. Figure 12 Trading Strategy Code für die EURUSD Stop-and-Reverse-Strategie links, MetaTrader 4 rechts, TradeStation Klicken Sie auf die Abbildung, um die entsprechende Code-Datei zu öffnen. Laden Sie eine Builder-Projektdatei mit den in diesem Artikel beschriebenen Einstellungen herunter. Dieser Artikel untersuchte den Prozess des Aufbaus eines hybriden, regelbasierten Neuronalen Netzwerk-Strategie für die EURUSD mit einem Stop-and-Reverse immer im Marktansatz mit Adaptrade Builder Es wurde gezeigt, wie der Strategiecode für mehrere Plattformen generiert werden kann, indem man eine gemeinsame Teilmenge der Indikatoren auswählt, die in jeder Plattform die gleiche Weise arbeiten Einstellungen, die notwendig sind, um Strategien zu generieren, die von lang nach kurz und zurück umgekehrt wurden, wurden beschrieben, und es wurde gezeigt, dass die daraus resultierende Strategie positiv auf einem sepa Rate, Validierung Segment der Daten Es wurde auch überprüft, dass die Strategie ähnliche Ergebnisse mit der Daten-und Code-Option für jede Plattform. Als oben diskutiert hat, hat die Stop-and-Reverse-Ansatz mehrere Nachteile und kann nicht an alle Jedoch jedoch ein immer In-the-market-Ansatz kann mit Forex-Daten attraktiver sein, weil die Devisenmärkte rund um die Uhr handeln. Infolgedessen gibt es keine Session-Opening-Lücken, und die Trading-Aufträge sind immer aktiv und verfügbar, um den Handel umzukehren, wenn der Markt Änderungen Die Verwendung von Intraday-Daten 4-Stunden-Bars stellte mehr Datenstäbe für den Einsatz im Build-Prozess zur Verfügung, war aber ansonsten ziemlich willkürlich, da die immer marktübliche Art der Strategie bedeutet, dass Trades über Nacht getragen werden Wurde erlaubt, verschiedene Bedingungen für den Eintritt von Long und Short zu entwickeln, was zu einer asymmetrischen Stop-and-Reverse-Strategie Trotz des Namens, die resultierende Strategie tritt sowohl lange und kurze Trades auf Marktaufträge, obwohl markieren Et, stop, und Limit-Aufträge wurden alle durch den Build-Prozess unabhängig für jede Seite in der Praxis Umkehrung von Long zu Short würde bedeuten, verkaufen doppelt so viele Anzahl von Aktien auf dem Markt als die Strategie war derzeit lange, z. B. wenn die aktuelle Long-Position War 100.000 Aktien, würden Sie verkaufen kurze 200.000 Aktien am Markt Ebenso, wenn die aktuelle Short-Position war 100.000 Aktien, würden Sie 200.000 Aktien am Markt kaufen, um von kurz nach lang umgekehrt. Kürzere Preis Geschichte wurde verwendet, als wäre ideal Dennoch, die Die Ergebnisse waren positiv auf dem Validierungssegment, was darauf hindeutet, dass die Strategie nicht übertrieben wurde. Dies unterstützt die Idee, dass ein neuronales Netzwerk in einer Handelsstrategie eingesetzt werden kann, ohne die Strategie auf den Markt zu übertreffen. Die hier vorgestellte Strategie ist nicht vorgesehen Tatsächlichen Handel und wurde nicht in Echtzeit-Tracking oder Handel getestet. Allerdings kann dieser Artikel als Vorlage für die Entwicklung ähnlicher Strategien für die EURUSD oder andere Märkte verwendet werden Wege, jede Handelsstrategie, die Sie entwickeln, sollte gründlich in Echtzeit-Tracking oder auf separaten Daten getestet werden, um die Ergebnisse zu validieren und sich mit den Handelsmerkmalen der Strategie vor dem Live-Handel vertraut zu machen. Dieser Artikel erschien in der Februar 2015 Ausgabe der Adaptrade Software newsletter. HYPOTHETISCHE ODER SIMULATIERTE LEISTUNGSERGEBNISSE HABEN BESTIMMTE INHERENTE BESCHRÄNKUNGEN EIN WIRTSCHAFTLICHE LEISTUNGSAUFNAHME WERDEN, ERFÜLLEN DIE ERWEITERTEN ERGEBNISSE NICHT, DASS DIE HÄNDE NICHT AKTUELL WERDEN KÖNNEN, DASS DIE ERGEBNISSE NICHT AUF DIE AUSWIRKUNG VORGESEHEN WERDEN KÖNNEN , IF ANY, OF CERTAIN MARKET FACTORS, SUCH AS LACK OF LIQUIDITY SIMULATED TRADING PROGRAMS IN GENERAL ARE ALSO SUBJECT TO THE FACT THAT THEY ARE DESIGNED WITH THE BENEFIT OF HINDSIGHT NO REPRESENTATION IS BEING MADE THAT ANY ACCOUNT WILL OR IS LIKELY TO ACHIEVE PROFITS OR LOSSES SIMILAR TO THOSE SHOWN. If you d like to be informed of new developments, news, and special offers from Adaptrade Softw are, please join our email list Thank you. Neural Networks for FOREX Trading. In this article an example of using of our Neural Networks Software to create a complete neural network trading system. This example uses the Cortex built-in scripting language so please read the scripting language guide first. Using Neural Networks to create FOREX Trading Strategy. In this free online tutorial you will find the full cycle of using neural networks Cortex Neural Networks Software for Forex trading or stock market trading the idea is the same. You will learn how to choose inputs for the artificial neural networks and how to decide what to use as the output. You will find an example of a ready to use script that allows to perform neural networks optimization of both the structure of Neural Network number of neurons and the forex trading system stop loss etc. Finally the part that is not present in most tutorials , you will learn what to do next After all, Cortex Neural Networks Software cannot do real t ime trading, you need to use something like Trade Station, MetaQuotes or MetaTrader How to port the FOREX trading system from Cortex to your favorite trading platform Do you have to deal with DLLs, ActiveX controls and low-level programming The answer is NO Cortex Neural Networks Software comes with the easy to use feature that allows you to easily port the resulting trained Neural Network to the scripting language of your trading platform No DLLs, DDE, ActiveX or any other low-level solutions - everything is plain and simple. Important note this is NOT a how to trade tutorial Instead, it tells you how to use Cortex Neural Networks Software but you still need to invent your own trading system The one we use here is barely a starting point, and shouldn t be used as a forex trading strategy as is The idea of this text is to teach you to create NN-based trading systems and to port them to the trading platform of your choice The example is, however, ovesimplified, and can only be used as th e illustration of trading principles Same way, the MACD trading system, that can be found in many tutorials, is not working well anymore as markets have changed , but still is a good example of using indicators for mechanical trading In two words do your own analysis. Another important note the tutorial uses examples, lots of them To make your life easier, I have included them all, not just fragments However it makes the text much longer Also, I am going from the very first, clumsy, forex trading system to more advanced, every time explaining what had been improved and why Be patient, or jump directly to the section you need. Final important note the code is not something carved in stone, it could change while this text was written The final versions of script files are included in Cortex archive. Pitfalls of FOREX BUY SELL Signals What is wrong with simple examples. In the Cortex Neural Networks Software user s guide we used a simple example of an aftifficial Neural Network predicting the price of GENZ stock To find out what is wrong with this approach, let s do the same simple example, using instead of the use 800 records in the learning set, as is a little bit shorter, then. It just wouldn t work Why. The reason will become evident, if you ask yourself What is the reason neural network forecasting of future values can be done on the first place. The answer is it is learning to do what is called neural networks pattern recognition to recognize patterns, and if there is a hidden logic in these patterns, then even a new pattern with the same logic will be recognized. That s a trick - with the same logic There is not even one, but three problems here. First of all, if you look at the Microsoft s stock price, you will notice, that it was going down in the learning part of our data, and sideways - in the testing part So it is possible, that the logic had changed. Second, and even more important - WHAT IS THE PATTERN You see, if we teached the neural network in the range 10 - 100 , and then presented it with something in the 1 to 3 range - they are different patterns 10, 20, 30 and 1, 2, 3 look similar to the human because - BECAUSE - we have this ability to divide by ten, when presented with numbers ending with zero It is what is called a pre-processing of the data, and by default, the NN can not do it. Can we teach it Of course What is it EXACTLY we need to teach it. This is the third, and the most important one We do not need the price prediction We do not care What we need is FOREX buy sell signals. Now, wait a minute We need a to have our input both learning and testing in the same range, and we need b to be able to make trading decisions based on it Isn t it what we call an indicator Bingo. So, that s what we are going to do - we will build an indicator, to feed it to the NN as an input, and we will try to get a prediction of the indicator value, not the worthless stock price. In our first example, we will load stock quotes from the disk, open the Neural Netwo rk file and start the learning - all in an automated mode. Create a new script file or open the one that came with the Cortex Neural Networks Software archive and call it. First of all, we need to download the price values from the file We are going to use the CLV indicator see below , but to calculate it, we need split-adjusted values for High and Low, not just for close Here is how to get them. The first line assigns the path to the strStockPath variable, of course, you will have to edit it, if your data file is located in the different directory. In the second line we specify, that this path is not relative the relative to the location of file. The TABLELOADER receives the path, the empty string for the start line , 1 - to skip the first line column names , part of the file s footer line the last line in does not contain data , it is also instructed to load the column number 0 and call it arrDate , 2 arrHigh , 3 arrLow , 4 arrC and 6 arrClose For a full description of TABLELOADER, see th e SLANG reference guide. Then we calculate split, by dividing the Adjusted Close by Close, and use this value to adjust Low and High. The file contains newest data FIRST, while we want them LAST. Next, we need to create an indicator Let s say, it is going to be a Close Location Value indicator, though in the real life I would probably use more than one indicator as the NN input. The Close Location Value indicator is calculated like. CLV Close - Low - High - Close High - Low , where Close, Low and High are for the interval, not necessarily for a single bar Note, that we want it in the 0 - 1 range, to make it easier to normalize to our NN s range which is, again, 0-1.Next, we need to create a lag file Let s use lags equal to 1, 2 9 For details on file functions, see the SLANG reference guide Note, that the Cortex s NN dialog can produce simple lags automatically you can use a Generate lag button But later in this text, we are going to work with complex lags which means, they are not 1, 2, 3 b ut 1, 3, 64 whatever , so we need to create the code that can handle this task in a more flexible way. Having the lag file, we are ready to create our first neural network This function takes a lot of parameters, so be carefull However, the code is really simple. By the way, most of this code can be removed, if you think you can handle numbers, instead of meaningfull names in your code, however, that would be a very bad coding practice. Now, after we have a neural network and the lagged file with data, we need to teach the network The lag file has 1074 records, so it is reasonable to use 800 as a learning set, and the remaining 274 as a testing set. You can, of course, open a network file and to click the Run button on the Learning tab But as this is an introduction to advanced Cortex Neural Networks Software programming, let s use SLANG builtin scripting language instead. The following code brings up the modal dialog with ann NN settings Note, that if you want to have a privilege of clicki ng the Run button, you need to change the. The bStartLearning can be 0, in which case the dialog will wait for your input, or 1, then the learning will begin aytomatically. The bResumeScript, if equals 1, will resume the script, if you close the dialog by clicking the OK button. The bReset is used to reset the network before the learning begins. Run the script, and wait for the epoch counter to exceed 1000, then click Stop Go to the Apply tab, and click Apply This will run the entire data set both learning and testing through the NN, and create the file, containing both original input-output, and the NN-generated prediction, this way you can easily plot them and compate against each other. Go to the Output tab, select file, click Browse file , Select fields , then select the No in the left list box, and by holding down the CTRL key while selecting with the mouse Clv and NN Clv in the right list box Click Chart to see how good our prediction is Well It is more or less good, from what we can say by looking at it Still, nothing extraordinary. This was just an example of what you can do with SLANG scripting, and how to automate Cortex s routine tasks However, until now, we did nothing you couldn t do by hand Well almost nothing, because if you want to create a custom lag file, with, say, Clv-100, Clv-50, Clv-25 columns, then you will have to use SLANG or Excel , because you cannot do in in Cortex without scripting. FOREX Trading Strategy what to optimize. Here is our next problem Do we need a good-looking prediction, or do we need the one we can use to trade with profit The question seems odd, but just think about it for a moment Let s say we have a VERY good 1-hour prediction 95 accurate Still, how far can the price go in one hour Not too far, I am afraid Compare it to the situation, when you have a rather inaccurate 10-hours prediction Will it be better. To answer this question, we need to actually trade, a simple comparison of the mean errors produced by the two NNs will not help. The second part of the same problem is in the way we define a good prediction Let s say we have a network, that produces the prediction, which is 75 accurate Compare it to the NN, that is producing 100 accurate prediction The last one is better Now, DIVIDE the output prediction of the 100 accurate NN by 10 We will have a VERY inaccurate network, as its signal is nowhere near the signal we used as a desired output And yet, it can be used same way we used 100 accurate NN, all we have to do is to multiply it to 10.See, the NN is created, by tuning the mean quadratic error, and not the correlation, so, at least in theory, a better NN can show poor results, when used for the actual stock Forex trading. To solve this problem, we need to test our NNs using trading, and to use results of this trading profit and drawdowns to decide, if this NN is better than the other one. Let s do it Let s create a program, that can be used to fine-tune NN, and this time, by fine-tuning, we will mean tradin g results. Neural Network Trading Few short notes. First of all, in our example above, the automatic learning will never stop, because we haven t specified any stop criteria In the dialog, or in the CREATENN function, you can provide the min error when the NN reaches it, it stops and, if bResumeScript is set to 1, the dialog will close and the script will resume Also yo can provide the maximum number of epochs, or both I am not using it in the example below, at least not always, because I am planning to watch the learning and to click STOP when I think the NN is ready If you want to do it in fully automatic mode, pay attention to these parameters. Second One of the ways to make a network smaller, faster and more accurate, is to begin with the small network, and increase it s size, neuron by neuron Obwiously, the number of the input neurons is determined by the number of input data columns but we can vary them, too , and the number of output neurons should be equal to the number of output data columns usually one, but not necessarily This means we need to optimize the number of neurons in the hidden layer s. Also, as I have mentioned, we don t really know which data to use Will Clv-15 15 days delayed increase the accuracy of our prediction Do we need Clv-256 Will it be better to use both of them in the same NN, or will adding Clv-256 ruin our performance. Using nested cycles to try different input parameters, you can. Create the NN, same way we did it for the stock data let me repeate, for the NN, there is no difference between stocks and FOREX, it just happened that I have couple of high quality data files for FOREX that I want to process, while writing this text. Try different combinations of lags. Try different number of neurons in the hidden layer. and different combinations of different indicators. However, if you try all possible combinations of all possible parameters, you will NEVER get your results, no matter how fast your computer is Below, we will use couple of tricks to reduce calculations to a bare minimum. By the way, it may seem, that if you start from one hidden neuron, then increase it to 2, 3 and so on, and at some point the error quality of the prediction or the profit if you test the NN by trading using it will begin to go down, then you have your winner Unfortunately, I cannot prove, that after the first performance peak there can be no second one It means, that the error may go like 100, 30, 20, 40, 50 it was just at its minimum, right and then 30, 20, 10, 15 the second minimum We just have to test all reasonable numbers. Third Optimization is a two-edged sword If you over-optimize your code, it may not work outside the data you used to fine-tune it I will do my best to avoid this pitfall If you want to do addition al optimizations to your code or NN, I advise you to do a research in the Internet, to learn more about hidden problems of this approach ALso, I am going to pay some attention to the smoothness of the profit curve The profit that looks like 0, -500, 1000, -100, 10000 may be great, but the profit 0, 100, 200, 300, 400 is better, as it is less risky We may talk about it later. Finally, for this example we are going to use FOREX, rather than stock prices From the point of view of the NN there is no difference, and from my point - Forex is much more fun to trade If you prefer stocks, the code can easily be modified. A FOREX Trading Strategy to play with. First of all, let s create a prototype of our code, one that can easily be optimized in future It is going to be a trading system, that uses a Neural Network to trade and produces a chart profit against trade number It will also calculate drawdown, as a measure of robustness of our trading system. The main difference here is that we use functi ons, instead of placing all the code in the main block of the program This way it is much easier to manage. Second, we have a TestNet function I am using a very simple algorithm of trading The CLV indicator is confined to 0 - 1 interval our version of CLV is , so when the indicator crosses up the dBuyLevel see code above , I am buying, when it is crossing down the dSellLevel, I am selling. Obviously, it is not the best trading strategy, but it will do for our purpose just for now If you want to improve it, here are some pointers First, you may want to have a system, that is not ALWAYS in the market Second, you may want to use more than one indicator as inputs, and maybe, more than one NN, so that the trading decision is made based on few predicted indicators We will add some improvements to the trading algorithm later. We use some standard assumptions of the FOREX trading spread is 5 points, leverade is 100, min lot is 100 mini-FOREX. Let s take a look at our trading system Once again, it is an oversimplified one An important note the TestNn is called last, and it has access to all variables that were created to that point So if you see a variable that I am using, without initializing it, it probably means that it was initialized in NewNn , TeachNn or some other function that was called prior to TestNn. To make things easier, comments are placed in the code. Few words about the drawdown There are few ways of calculating it, and we are using what I consider the most honest The drawdown is a measure of instability of our system What is a chance, that it will loose money Lets say the initial amount is 1000 If the profit goes 100, 200, 300, 400 the drawdown is 0 If it goes 100, 200, 100 then the drawdown is 0 1 10 , as we have just lost an amount, equal to 1 10 of the initial deposit from 1200 to 1100.I would strongly advice against using trading systems with large drawdowns. Also, here I use a drawdown, that is to be used with variable lot size However, in the actual samples, that come with the eBook, you will see another version. As you can see, here we always use 1000 the initial amount to calculate the drawdown The reason is simple we always use the same lot size no money management yet , so there is no difference, how much money we have already accumulated on our account, an average profit should be constant The worse possible scenario in this case looks like this from the very beginning 1000 on account we are loosing money If we use 1000 to calculate the drawdown, we will get the worse drawdown This will help us not to trick ourselves For example, say, we traded for some time, and we have 10,000 on our account Then we loose some money, and we now have 8,000 Then we have recovered, and got 12,000 Good trading system Probably not. Let s repeat the logic again, as it is very important and it will become even more important, when we start doing money management We trade using fixed size lots So, statistically, there is no guarantee, that the maximum loss wi ll not happen at the very beginning, when we only have 1000 And if it happens, we will have -1000 10,000 - 8,000 , so the trading system is probably too risky. When we talk about the money management probably, not in this text , we will have to use different approach to drawdown calculation. Note, that in this trading system, I am using the worse possible scenario I am buying using High and selling, using Low Many testers do not follow these rules, and create trading systems, that work fine on historical data But in the real life, these trading systems have very poor performance Why. Take a look at the price bar It has Open, High, Low and Close Do you know, how the price was moving inside the bar No So, let s say, your trading system generated a buy signal, at the bottom of the price bar if dLow. Note that I am using dLotSize equal 0 1 lot 100 Obviously, in the real trading, you will benefit greatly, if the lot size is calculated depending on the money you have, something like. However, we are doing testing here, not trading And for testing, we need, among other things, to see how smooth the profit curve is This is much easier to do if the lot size is the same in ideal situation, for dLotSize 100 we will get a straight line, with some positive slope, while in case of the adjustable lot size we will get an exponent, that is much harder to analyze. Later in this text, we will apply money management rules to our trading system, but not yet. After we are done with the last part of our testing function, let s walk through the rest of the code. The following function creates a CLV indicator It takes the interval as a parameter, which means that we can call it many times, during the optimization, passing different numbers. Note, that I am using the NN that works in the 0 - 1 interval The data can be normalized, of course, but I chose to divide the indicator by 2 and to add 0 5, so that it is in 0 - 1 range. To make lag file, we can use the CREATELAGFILE function Alternatively, we ca n do it by explicitly providing all the necessary code In this case, we have more control, and we are going to need it, if we begin varying number of lagged columns and so on. The nRemoveFirst parameter is important Many functions, like indicators, moving averages, lag generators, for that matter, do not work well within the first few records of the dataset Let s say we have MA 14 - what will it place in the records 1 - 13 So we choose to simply remove the first few unreliable records. For the NewNn, as well as for all functions of this program, we need to pass as parameters only what can be changed during optimization process For example, there is no need to pass a skip before parameter, as it is always the same. The TeachNn function simply brings up the NN dialog. Finally, we need a charting function It is not mandatory, but it is always a good idea to see what our profit line looks like The following code uses the XML to produce a chart, so it is a good idea to read the tutorial Alterna tively, you can draw the chart, rather than saving it in a file To do it, use one of the samples, that are in the samples scripts directory Finally, you can modify the code, to produce HTML, rather than XML HTML is easier to learn, but the code itself will be a bit less readablepile and Run the script. Well As expected, using 7 hours as an interval for the CLV produced very poor results. FOREX Trading Strategies and Optimization. The reason for the poor results is quite obvious we used the Interval, Stop Loss, buy and sell levels and other parameters, that were purely random - we just picked first that came in mind What if we try few combinations. FOREX Trading Signals What to optimize. First of all, by overoptimizing the buy and sell levels, we can ruin our future performance However we still can tune them, especially, if the performance is close for close values of buy and sell limits For example, if we have -10 profit at buy limit equal 0 3, and 1000 profit when it equals 0 35, then ther e is probably a lucky coincidence, and we should not use 0 35 for our trading system, as in future it will probably not happen again If, instead, we have -10 and 10 instead of 1000 , it may be safer to use. Generally, our trading system should be built for WORSE possible scenario, as if during the real trading the performance will be better, then during the test, we will survive, but not the other way around. We can vary the value for the indicator interval, provided we have enough trades, so that we can be confident, in terms of statistics, in the performance of a system. We certainly can vary the number of neurons, I don t think it can be overoptimized easily. We can vary number of inputs and lags for inputs It is possible to overoptimize this, but it is not very likely to happen. And, of course, we can try different indicators. Accurate FOREX Signals How to optimize. As have already been mentioned, if we start trying all possible combinations, it will take forever So we are going to cheat We will create pre-defined sets of parameters, that we think are reasonable, and pass them to the program. To make as few calculations as possible, note, that Clv-1 and Clv-2 are, probably, important, but what about Clv-128 And - if we already have Clv-128, do we need Clv-129 Probably, not So we are going to have something like Clv-1, Clv-2, Clv-4, Clv-8 Clv-128 with just few variations, which will make our calculation time thousands times shorter. FOREX Professional System Trading Can it work at all. What is it exactly we want to predict Until this point we have used 1 hour chart for EURUSD, and we were predicting the next bar s CLV Will the CLV 2 be better What about CLV 3.Also, especially considering the poor performance of our first trading system, it would be nice to know, that - at least in the ideal world, the goal profitable trading can be achieved. To answer these questions, let s create a simple testing program We assume, that our prediction is 100 accurate, and, based on this as sumption, we will use CLV N, not the NN predicted one That s right - we are going to take data from the future, and to use them instead of the NN prediction This approach wouldn t work in the real life, of course, but at leats, it will give us some ideas of what to expect. When looking at the results, please keep in mind, that we are not using any advanced money management, our lot size is set to a minimum 100 If you use variable lot sizes, results will be dramatically different But even at a lot size set to 0 1 we can see below that getting the information from the future is an ultimate trader s holly graal. You are already familiar with this code, it was used in It handles data loading The only difference is in the part that obtains the list of files in the images directory and deletes all files with the extention The reason for this code is simple during our tests we are going to create many - may be, thousands - image files We don t want them to hung around after we are done So at th e beginning of the script we are deleting images, created by other scripts. Just a few comments We do not want to try all possible values for, for example, CLV interval Instead, we can create an array, that contains only values we want to test Then see below we will walk through this array. Stop losses are important part of any trading strategy, so I have decided to vary them as well It is a dangerous idea, however, as it is easy to overoptimize the system. I am planning to test different values for buy and sell levels, but it will be done in cycle, without using arrays. Unlike in our previous example, we want to have a large XML file, containing many images To do it, I have moved the code, that is forming the XML header and footer outside of the Chart function Read one of the online XML tutorials for details. Note, that I am using 0 as the first lag, which means, that first I am testing the indicator CLV that was not shifted from the future Just to get an idea, how good out trading system would be without NN horrible, is the right word It is loosing all the money. Cortex uses the Internet Explorer control to display XML pages When pages grow large, it takes a lot of memory If your computer cannot handle it, consider creating multiple XML or HTML pages, instead In the case of forexnn02, it should not be a problem, as the page is relatively short Alternatively that is what I am doing in scripts later in this text , create XML file, but do not open it from Cortex Open them using Internet Explorer instead - unlike IE control, the Internet Explorer does not have the memory problem. Now the code that is trying different combinations of parameters. Here, we are using nested cycles In every cycle, we are assidning some variable for example, nInterval for the outer cycle This way the cycle will assign values of all elements of a corresponding array, one in a time Then WITHIN it, the inner cycle is used, and so on, so that all combinations of all array elements are tested. In the inn ermost cycle, I am calling the Test function, to test trade , and Chart to add a new picture to a list of images saved on disk Note, that this Chart does not show any images, until all cycles are completed. The Test and CreateClv functions are almost the same as in the previous example The only real difference is due to the fact that it is called more then once To do it, I am calling ARRAYREMOVE to cleanup arrays. Also, notice, that we are only creating charts for the combinations of parameters, that produce trading system with positive profit Otherwise, we call continue , to skip the Chart function. Finally, we have Take Profit now, so our trading system can be a bit more flexible. The Chart function was broken into two pieces The header and the footer should be written to the XML file only once, so they were moved to the main part of the program. Also, I am using the counter, to save files under the different names The information about parameters is written to the header of an image, so we can easily see which one it is Finally, images are only saved for winning configurations, meaning the balance at the end should be more, then at the beginning. Run the program it will take some time to complete You will end up with a large XML page with images, one for each winning configuration. Some of the results are great, however, as we used data from the future , this system will not work in the real life Actually, if you look at the Test function, you will notice, that the cycle stops before we reach the last element of arrClose. for nBar nRemoveFirst 1 nBar. THIS IS C , just an example. As you can see, the code is really simple Now lets do the same using the SLANG script As in examples before, we will keep the overall structure of the code, so that this example looks familiar The only difference is that instead of using the built-in APPLYNN function, we call the function of our own The code that we do not use such as cycles is commented, but not removed. Note, that the logic behin d it was discussed in Neural Networks and Stock Forex Trading article already Briefly, the output of this script is formated to be compatible with the MQL, MetaTrader s scripting engine MetaTrader is a trading platform we use, if you want something different, like TradeStation, for example, you will have to alter the code to comply to its syntax. Then, in the following chapters, we are going to insert this code in the MetaTrader s indicator, and to use it to trade. Porting script to trading platform. The next step is not really required, but it is something, that may be useful We are going to create a version of a tsc file one above , but this time, we will use SLANG Cortex scripting language to emulate APPLYNN function The reason is, in the next chapter we are going to port it to the scripting language of a MetaTrader trading platform, so it is a good idea to make sure everything works. After we run this function, we discover, that the result it produces is the same, as the forexnn05a pro duced, which means the code works fine. Note, that there is a difference at the beginning of the charts, as our NN does not try to process the data at the beginning where lag is incomplete , while the built-in NN does not know about this problem Of course, it doesn t affect the result, as the beginning of the chart is ignored by using the nRemoveFirst parameter in our script set to 200, which is guaranteed to be larger, then our lag. Using third-party trading platform. We have the NN that more or less can be used We have the script, implementing this NN without calls to the Cortex-specific NN functions Now we are going to port it to the trading platform that can be used for the real trading, which means it can contact brocker, place orders and earn or loose money. As a trading platform, I am going to use MetaTrader. Disclaimer I am not related to MetaQuotes in any way I do not work for them, I am not their affiliate and so on I use MetaTrader, ONLY because I like it. I find this program user - friendly, flexible and powerful, and not a monster Also, it is free compare to other packages of this class. The only minor problem is that it is not always easy to find the dealer using MT in your area Then, when you do a research, you may find couple of brockers, with screenshots on their web sites, that look suspiciously familiar Yes, they use MetaTrader, but they don t call it MetaTrader. I have asked for clarification at the company s forum, and they have told me, that they don t reveal brockers using their services Very strange. One of the brockers that is not hiding the fact they use MT, is Alpari They will allow you to open a Demo account, so that you can trade in a real time, but without risking your money. Warning I am not going to recommeng services of Alpari Once again, I am not being paid for that Try their Demo account, and use your own judgement Or you can start your own research at Internet forums. Finally, if you do not like the MT, you can probably follow the example belo w using TS, MS or some other trading platform This is just an example. Our MT-based trading system will include two files, the indicator and an expert This is the way they call it in MQL scripting language of MT , and I am going to follow this naming convention. The indicator implements the neural network and draws a chart An expert takes these data and does trading As MetaTrader has a strategy tester , we will be able to test our strategy, to see how good it is. I will assume, that you are familiar with MQL programming, it is quite close to SLANG and tutorials can be found both at MetaQuotes and Alpari. Finally, I am using the code structure, that is borrowed from MetaQuotes forum, permission to use it the author of the corresponding posts had granted me permission to use fragments of his code. Also, as some of our MetaTrader code is the same for all experts and indicators, we moved it to a separate library file MetaTrader s libraries are nothing but includable files This library takes car e of synhronization, when two or more expert are trying to run in the same time, as well as of few other things If you use MetaTrader, it will help you to create robust experts, in any case, the MQL language is easy to understand. a helper library. The code should look familiar, all I did was re-writing it, using slightly different language syntax of MQL. This indicator has two buffers, and draws two lines, one for the original NOC, and one for the NN-predicted NOC For trading, you don t have to draw both indicator lines, of course see MQL tutorials to learn how to do it , but I have decided to show them together, so you can compare. Another difference, that you should know about, is the way MT performs testing It may, in some cases, be more accurate, then one we did we did the worse case scenario Of course, you can always to change the SLANG script from the examples above, to implement any logic you want. The result of our testing in MT is a bit better, then in Cortex, due to all these reasons. Keep in mind, that MT calculates the DD in a different way I still think, that my way is better. In should be especially noted, that no additional optimization had been performed using MetaTrader s optimizer We have just plugge d our MTS mechanical trading system in, and it worked as expected. That is it You can now create Cortex Neural Network, optimize it to do trading, and to port it to the trading platform of your choice. Download Cortex Order Cortex View Price List. Visibility is very important for this site If you like it please link to this URL.

Comments