Scam Example 1 – Let Losers Run!
This robot shows you one way in which unscrupulous marketers can try and scam you by showing you highly misleading "live" results on their website. The expert advisor uses the "hedging" feature of MetaTrader 4 to prevent losing trades ever being displayed in the list of closed trades. You've probably heard the advice that you should cut your losses short and let your profits run. This EA does exactly the opposite. It still manages to produce an extremely impressive graph though!
This scam example is based on our first example robot which used random entries. This time however it goes both long and short at the same time. When one out of the two trades reaches its take profit level it shows up in the MetaTrader "Account History" list as a closed trade with a healthy profit. At this point the take profit and stop loss prices on the losing order are cancelled. The loss is allowed to run forever! Rinse and repeat, and check below to see what happens. Whilst the green equity line on the backtest results reveals the true picture, the blue account balance line shows no losing trades whatsoever, at least until the strategy tester closes every order at the end of the test. The thing is though, on a forward test on a demo account, any reports created from the "Account History" tab in MetaTrader only show the impressive account balance. Try it for yourself and see.
Here are the results from the MetaTrader strategy tester (but with the list of trades shortened):
Symbol | EURUSD (Euro vs US Dollar) | ||||
Period | 1 Minute (M1) 2009.05.04 00:00 – 2009.05.29 21:59 (2009.05.04 – 2009.05.30) | ||||
Model | Every tick (the most precise method based on all available least timeframes) | ||||
Parameters | Magic=54321; Slippage=30; ProfitTarget=500; StopLoss=5000; Lots=0.1; StpMode=true; | ||||
Bars in test | 29376 | Ticks modelled | 1313890 | Modelling quality | 25.00% |
Mismatched charts errors | 0 | ||||
Initial deposit | 10000.00 | ||||
Total net profit | -5682.50 | Gross profit | 22486.30 | Gross loss | -28168.80 |
Profit factor | 0.80 | Expected payoff | -33.43 | ||
Absolute drawdown | 5784.90 | Maximal drawdown | 6596.20 (61.01%) | Relative drawdown | 61.01% (6596.20) |
Total trades | 170 | Short positions (won %) | 85 (40.00%) | Long positions (won %) | 85 (100.00%) |
Profit trades (% of total) | 119 (70.00%) | Loss trades (% of total) | 51 (30.00%) | ||
Largest | profit trade | 879.80 | loss trade | -937.70 | |
Average | profit trade | 188.96 | loss trade | -552.33 | |
Maximum | consecutive wins (profit in money) | 84 (4200.00) | consecutive losses (loss in money) | 6 (-1386.30) | |
Maximal | consecutive profit (count of wins) | 4200.00 (84) | consecutive loss (count of losses) | -3390.90 (5) | |
Average | consecutive wins | 5 | consecutive losses | 2 |
# | Time | Type | Order | Size | Price | S / L | T / P | Profit | Balance |
1 | 2009.05.04 00:00 | buy | 1 | 0.10 | 1.32818 | 0.00000 | 0.00000 | ||
2 | 2009.05.04 00:00 | modify | 1 | 0.10 | 1.32818 | 1.27793 | 1.33318 | ||
3 | 2009.05.04 00:00 | sell | 2 | 0.10 | 1.32793 | 0.00000 | 0.00000 | ||
4 | 2009.05.04 00:00 | modify | 2 | 0.10 | 1.32793 | 1.37818 | 1.32293 | ||
5 | 2009.05.04 02:40 | t/p | 1 | 0.10 | 1.33318 | 1.27793 | 1.33318 | 50.00 | 10050.00 |
6 | 2009.05.04 02:40 | modify | 2 | 0.10 | 1.32793 | 0.00000 | 0.00000 | ||
7 | 2009.05.04 02:40 | buy | 3 | 0.10 | 1.33346 | 0.00000 | 0.00000 | ||
8 | 2009.05.04 02:40 | modify | 3 | 0.10 | 1.33346 | 1.28321 | 1.33846 | ||
9 | 2009.05.04 02:40 | sell | 4 | 0.10 | 1.33321 | 0.00000 | 0.00000 | ||
10 | 2009.05.04 02:40 | modify | 4 | 0.10 | 1.33321 | 1.38346 | 1.32821 | ||
11 | 2009.05.04 09:29 | t/p | 4 | 0.10 | 1.32821 | 1.38346 | 1.32821 | 50.00 | 10100.00 |
12 | 2009.05.04 09:29 | modify | 3 | 0.10 | 1.33346 | 0.00000 | 0.00000 | ||
13 | 2009.05.04 09:29 | buy | 5 | 0.10 | 1.32816 | 0.00000 | 0.00000 | ||
14 | 2009.05.04 09:29 | modify | 5 | 0.10 | 1.32816 | 1.27791 | 1.33316 | ||
15 | 2009.05.04 09:29 | sell | 6 | 0.10 | 1.32791 | 0.00000 | 0.00000 | ||
16 | 2009.05.04 09:29 | modify | 6 | 0.10 | 1.32791 | 1.37816 | 1.32291 | ||
17 | 2009.05.04 12:25 | t/p | 6 | 0.10 | 1.32291 | 1.37816 | 1.32291 | 50.00 | 10150.00 |
18 | 2009.05.04 12:25 | modify | 5 | 0.10 | 1.32816 | 0.00000 | 0.00000 | ||
19 | 2009.05.04 12:25 | buy | 7 | 0.10 | 1.32287 | 0.00000 | 0.00000 | ||
20 | 2009.05.04 12:25 | modify | 7 | 0.10 | 1.32287 | 1.27262 | 1.32787 | ||
21 | 2009.05.04 12:25 | sell | 8 | 0.10 | 1.32262 | 0.00000 | 0.00000 | ||
22 | 2009.05.04 12:25 | modify | 8 | 0.10 | 1.32262 | 1.37287 | 1.31762 | ||
23 | 2009.05.04 14:40 | t/p | 7 | 0.10 | 1.32787 | 1.27262 | 1.32787 | 50.00 | 10200.00 |
24 | 2009.05.04 14:40 | modify | 8 | 0.10 | 1.32262 | 0.00000 | 0.00000 | ||
25 | 2009.05.04 14:40 | buy | 9 | 0.10 | 1.32816 | 0.00000 | 0.00000 | ||
26 | 2009.05.04 14:40 | modify | 9 | 0.10 | 1.32816 | 1.27791 | 1.33316 | ||
27 | 2009.05.04 14:40 | sell | 10 | 0.10 | 1.32791 | 0.00000 | 0.00000 | ||
28 | 2009.05.04 14:40 | modify | 10 | 0.10 | 1.32791 | 1.37816 | 1.32291 | ||
29 | 2009.05.04 15:15 | t/p | 9 | 0.10 | 1.33316 | 1.27791 | 1.33316 | 50.00 | 10250.00 |
30 | 2009.05.04 15:15 | modify | 10 | 0.10 | 1.32791 | 0.00000 | 0.00000 | ||
31 | 2009.05.04 15:15 | buy | 11 | 0.10 | 1.33344 | 0.00000 | 0.00000 | ||
32 | 2009.05.04 15:15 | modify | 11 | 0.10 | 1.33344 | 1.28319 | 1.33844 | ||
33 | 2009.05.04 15:15 | sell | 12 | 0.10 | 1.33319 | 0.00000 | 0.00000 | ||
34 | 2009.05.04 15:15 | modify | 12 | 0.10 | 1.33319 | 1.38344 | 1.32819 | ||
35 | 2009.05.04 17:04 | t/p | 11 | 0.10 | 1.33844 | 1.28319 | 1.33844 | 50.00 | 10300.00 |
36 | 2009.05.04 17:04 | modify | 12 | 0.10 | 1.33319 | 0.00000 | 0.00000 | ||
37 | 2009.05.04 17:04 | buy | 13 | 0.10 | 1.33886 | 0.00000 | 0.00000 | ||
38 | 2009.05.04 17:04 | modify | 13 | 0.10 | 1.33886 | 1.28861 | 1.34386 | ||
39 | 2009.05.04 17:04 | sell | 14 | 0.10 | 1.33861 | 0.00000 | 0.00000 | ||
40 | 2009.05.04 17:04 | modify | 14 | 0.10 | 1.33861 | 1.38886 | 1.33361 | ||
41 | 2009.05.05 07:54 | t/p | 14 | 0.10 | 1.33361 | 1.38886 | 1.33361 | 50.00 | 10350.00 |
42 | 2009.05.05 07:54 | modify | 13 | 0.10 | 1.33886 | 0.00000 | 0.00000 | ||
43 | 2009.05.05 07:54 | buy | 15 | 0.10 | 1.33358 | 0.00000 | 0.00000 | ||
44 | 2009.05.05 07:54 | modify | 15 | 0.10 | 1.33358 | 1.28333 | 1.33858 | ||
45 | 2009.05.05 07:54 | sell | 16 | 0.10 | 1.33333 | 0.00000 | 0.00000 | ||
46 | 2009.05.05 07:54 | modify | 16 | 0.10 | 1.33333 | 1.38358 | 1.32833 | ||
47 | 2009.05.05 10:29 | t/p | 15 | 0.10 | 1.33858 | 1.28333 | 1.33858 | 50.00 | 10400.00 |
48 | 2009.05.05 10:29 | modify | 16 | 0.10 | 1.33333 | 0.00000 | 0.00000 | ||
49 | 2009.05.05 10:29 | buy | 17 | 0.10 | 1.33886 | 0.00000 | 0.00000 | ||
50 | 2009.05.05 10:29 | modify | 17 | 0.10 | 1.33886 | 1.28861 | 1.34386 | ||
51 | 2009.05.05 10:29 | sell | 18 | 0.10 | 1.33861 | 0.00000 | 0.00000 | ||
52 | 2009.05.05 10:29 | modify | 18 | 0.10 | 1.33861 | 1.38886 | 1.33361 | ||
53 | 2009.05.05 18:21 | t/p | 18 | 0.10 | 1.33361 | 1.38886 | 1.33361 | 50.00 | 10450.00 |
54 | 2009.05.05 18:21 | modify | 17 | 0.10 | 1.33886 | 0.00000 | 0.00000 | ||
55 | 2009.05.05 18:21 | buy | 19 | 0.10 | 1.33356 | 0.00000 | 0.00000 | ||
56 | 2009.05.05 18:21 | modify | 19 | 0.10 | 1.33356 | 1.28331 | 1.33856 | ||
57 | 2009.05.05 18:21 | sell | 20 | 0.10 | 1.33331 | 0.00000 | 0.00000 | ||
58 | 2009.05.05 18:21 | modify | 20 | 0.10 | 1.33331 | 1.38356 | 1.32831 | ||
59 | 2009.05.06 02:22 | t/p | 20 | 0.10 | 1.32831 | 1.38356 | 1.32831 | 50.00 | 10500.00 |
60 | 2009.05.06 02:22 | modify | 19 | 0.10 | 1.33356 | 0.00000 | 0.00000 | ||
61 | 2009.05.06 02:22 | buy | 21 | 0.10 | 1.32829 | 0.00000 | 0.00000 | ||
62 | 2009.05.06 02:22 | modify | 21 | 0.10 | 1.32829 | 1.27804 | 1.33329 | ||
63 | 2009.05.06 02:22 | sell | 22 | 0.10 | 1.32804 | 0.00000 | 0.00000 | ||
64 | 2009.05.06 02:22 | modify | 22 | 0.10 | 1.32804 | 1.37829 | 1.32304 | ||
65 | 2009.05.06 13:15 | t/p | 21 | 0.10 | 1.33329 | 1.27804 | 1.33329 | 50.00 | 10550.00 |
66 | 2009.05.06 13:15 | modify | 22 | 0.10 | 1.32804 | 0.00000 | 0.00000 | ||
67 | 2009.05.06 13:15 | buy | 23 | 0.10 | 1.33378 | 0.00000 | 0.00000 | ||
68 | 2009.05.06 13:15 | modify | 23 | 0.10 | 1.33378 | 1.28353 | 1.33878 | ||
69 | 2009.05.06 13:15 | sell | 24 | 0.10 | 1.33353 | 0.00000 | 0.00000 | ||
70 | 2009.05.06 13:15 | modify | 24 | 0.10 | 1.33353 | 1.38378 | 1.32853 | ||
71 | 2009.05.06 15:06 | t/p | 24 | 0.10 | 1.32853 | 1.38378 | 1.32853 | 50.00 | 10600.00 |
72 | 2009.05.06 15:06 | modify | 23 | 0.10 | 1.33378 | 0.00000 | 0.00000 | ||
73 | 2009.05.06 15:06 | buy | 25 | 0.10 | 1.32851 | 0.00000 | 0.00000 | ||
74 | 2009.05.06 15:06 | modify | 25 | 0.10 | 1.32851 | 1.27826 | 1.33351 | ||
75 | 2009.05.06 15:06 | sell | 26 | 0.10 | 1.32826 | 0.00000 | 0.00000 | ||
76 | 2009.05.06 15:06 | modify | 26 | 0.10 | 1.32826 | 1.37851 | 1.32326 | ||
77 | 2009.05.06 19:37 | t/p | 25 | 0.10 | 1.33351 | 1.27826 | 1.33351 | 50.00 | 10650.00 |
78 | 2009.05.06 19:37 | modify | 26 | 0.10 | 1.32826 | 0.00000 | 0.00000 | ||
79 | 2009.05.06 19:37 | buy | 27 | 0.10 | 1.33380 | 0.00000 | 0.00000 | ||
80 | 2009.05.06 19:37 | modify | 27 | 0.10 | 1.33380 | 1.28355 | 1.33880 | ||
81 | 2009.05.06 19:37 | sell | 28 | 0.10 | 1.33355 | 0.00000 | 0.00000 | ||
82 | 2009.05.06 19:37 | modify | 28 | 0.10 | 1.33355 | 1.38380 | 1.32855 | ||
83 | 2009.05.07 01:38 | t/p | 28 | 0.10 | 1.32855 | 1.38380 | 1.32855 | 50.00 | 10700.00 |
84 | 2009.05.07 01:38 | modify | 27 | 0.10 | 1.33380 | 0.00000 | 0.00000 | ||
85 | 2009.05.07 01:38 | buy | 29 | 0.10 | 1.32851 | 0.00000 | 0.00000 | ||
86 | 2009.05.07 01:38 | modify | 29 | 0.10 | 1.32851 | 1.27826 | 1.33351 | ||
87 | 2009.05.07 01:38 | sell | 30 | 0.10 | 1.32826 | 0.00000 | 0.00000 | ||
88 | 2009.05.07 01:38 | modify | 30 | 0.10 | 1.32826 | 1.37851 | 1.32326 | ||
89 | 2009.05.07 11:06 | t/p | 29 | 0.10 | 1.33351 | 1.27826 | 1.33351 | 50.00 | 10750.00 |
90 | 2009.05.07 11:06 | modify | 30 | 0.10 | 1.32826 | 0.00000 | 0.00000 | ||
91 | 2009.05.07 11:06 | buy | 31 | 0.10 | 1.33378 | 0.00000 | 0.00000 | ||
92 | 2009.05.07 11:06 | modify | 31 | 0.10 | 1.33378 | 1.28353 | 1.33878 | ||
93 | 2009.05.07 11:06 | sell | 32 | 0.10 | 1.33353 | 0.00000 | 0.00000 | ||
94 | 2009.05.07 11:06 | modify | 32 | 0.10 | 1.33353 | 1.38378 | 1.32853 | ||
95 | 2009.05.07 13:35 | t/p | 32 | 0.10 | 1.32853 | 1.38378 | 1.32853 | 50.00 | 10800.00 |
96 | 2009.05.07 13:35 | modify | 31 | 0.10 | 1.33378 | 0.00000 | 0.00000 | ||
97 | 2009.05.07 13:35 | buy | 33 | 0.10 | 1.32757 | 0.00000 | 0.00000 | ||
98 | 2009.05.07 13:35 | modify | 33 | 0.10 | 1.32757 | 1.27732 | 1.33257 | ||
99 | 2009.05.07 13:35 | sell | 34 | 0.10 | 1.32732 | 0.00000 | 0.00000 | ||
100 | 2009.05.07 13:35 | modify | 34 | 0.10 | 1.32732 | 1.37757 | 1.32232 | ||
101 | 2009.05.07 13:39 | t/p | 33 | 0.10 | 1.33257 | 1.27732 | 1.33257 | 50.00 | 10850.00 |
102 | 2009.05.07 13:39 | modify | 34 | 0.10 | 1.32732 | 0.00000 | 0.00000 | ||
103 | 2009.05.07 13:39 | buy | 35 | 0.10 | 1.33292 | 0.00000 | 0.00000 | ||
104 | 2009.05.07 13:39 | modify | 35 | 0.10 | 1.33292 | 1.28267 | 1.33792 | ||
105 | 2009.05.07 13:39 | sell | 36 | 0.10 | 1.33267 | 0.00000 | 0.00000 | ||
106 | 2009.05.07 13:39 | modify | 36 | 0.10 | 1.33267 | 1.38292 | 1.32767 | ||
107 | 2009.05.07 13:52 | t/p | 35 | 0.10 | 1.33792 | 1.28267 | 1.33792 | 50.00 | 10900.00 |
108 | 2009.05.07 13:52 | modify | 36 | 0.10 | 1.33267 | 0.00000 | 0.00000 | ||
109 | 2009.05.07 13:52 | buy | 37 | 0.10 | 1.33825 | 0.00000 | 0.00000 | ||
110 | 2009.05.07 13:52 | modify | 37 | 0.10 | 1.33825 | 1.28800 | 1.34325 | ||
111 | 2009.05.07 13:52 | sell | 38 | 0.10 | 1.33800 | 0.00000 | 0.00000 | ||
112 | 2009.05.07 13:52 | modify | 38 | 0.10 | 1.33800 | 1.38825 | 1.33300 | ||
113 | 2009.05.07 14:07 | t/p | 37 | 0.10 | 1.34325 | 1.28800 | 1.34325 | 50.00 | 10950.00 |
114 | 2009.05.07 14:07 | modify | 38 | 0.10 | 1.33800 | 0.00000 | 0.00000 |
Here's the source code for the "robot":
//+------------------------------------------------------------------+
//| GuruScam01.mq4 |
//| Copyright © 2009, Marketing Dreams Ltd. All Rights Reserved. |
//| http://trading-gurus.com |
//| |
//| GuruTrader™ scam example 1 |
//| Version 1.0 |
//| |
//| How to produce an impressive "live" equity curve while actually |
//| losing money! |
//| |
//| Wealth Warning! This expert is for educational purposes only. |
//| It should NEVER be used on a live account. Past performance is |
//| in no way indicative of future results! |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2009, Marketing Dreams Ltd."
#property link "http://trading-gurus.com"
#define SLEEP_OK 250 #define SLEEP_ERR 250
//---- input parameters extern int Magic = 54321; extern int Slippage=30; extern int ProfitTarget=500; extern int StopLoss=5000; extern double Lots=0.01; extern bool StpMode = FALSE;
//---- static variables static int Dig; static double Points;
static bool Initialized = FALSE; static bool Running = FALSE; static int LongOrder; static int ShortOrder; static double LastBid; static double LastAsk;
static color clBuy = DodgerBlue; static color clSell = Crimson;
//+------------------------------------------------------------------+ //| Utility functions | //+------------------------------------------------------------------+ #include <stdlib.mqh> #include <stderror.mqh> #include <WinUser32.mqh>
//+------------------------------------------------------------------+ //| Expert helper functions | //+------------------------------------------------------------------+
//+------------------------------------------------------------------+ //| Modifies target and stop levels of an order | //+------------------------------------------------------------------+ int UpdateOrder(int Ticket, double TargetPrice, double StopPrice) { int ErrorCode;
if (OrderSelect(Ticket, SELECT_BY_TICKET) != TRUE) { ErrorCode = GetLastError(); Print("Error selecting order to modify ", Ticket, ": ", ErrorDescription(ErrorCode), " (", ErrorCode, ")"); return(-1); }
if (OrderModify(Ticket, OrderOpenPrice(), StopPrice, TargetPrice, 0)) { Sleep(SLEEP_OK); return (Ticket); }
ErrorCode = GetLastError(); RefreshRates(); Print("Error modifying order ", Ticket, ": ", ErrorDescription(ErrorCode), " (", ErrorCode, ")"); Sleep(SLEEP_ERR);
return (-1); }
//+------------------------------------------------------------------+ //| Places an order | //+------------------------------------------------------------------+ int Order(string symbol, int Type, double Entry, double Quantity, double TargetPrice, double StopPrice, string comment="") { string TypeStr; color TypeCol; int ErrorCode, Ticket; double Price, FillPrice;
Price = NormalizeDouble(Entry, Dig);
switch (Type) { case OP_BUY: TypeStr = "BUY"; TypeCol = clBuy; break; case OP_SELL: TypeStr = "SELL"; TypeCol = clSell; break; default: Print("Unknown order type ", Type); break; }
if (StpMode) { Ticket = OrderSend(symbol, Type, Quantity, Price, Slippage, 0, 0, comment, Magic, 0, TypeCol); } else { Ticket = OrderSend(symbol, Type, Quantity, Price, Slippage, StopPrice, TargetPrice, comment, Magic, 0, TypeCol); } if (Ticket >= 0) { Sleep(SLEEP_OK); if (OrderSelect(Ticket, SELECT_BY_TICKET) == TRUE) { FillPrice = OrderOpenPrice(); if (Entry != FillPrice) { RefreshRates(); Print("Slippage on order ", Ticket, " - Requested = ", Entry, ", Fill = ", FillPrice, ", Current Bid = ", Bid, ", Current Ask = ", Ask); } if (StpMode && ((StopPrice > 0) || (TargetPrice > 0))) { if (OrderModify(Ticket, FillPrice, StopPrice, TargetPrice, 0, TypeCol)) { Sleep(SLEEP_OK); return (Ticket); } } } else { ErrorCode = GetLastError(); Print("Error selecting new order ", Ticket, ": ", ErrorDescription(ErrorCode), " (", ErrorCode, ")"); } return (Ticket); }
ErrorCode = GetLastError(); RefreshRates(); Print("Error opening ", TypeStr, " order: ", ErrorDescription(ErrorCode), " (", ErrorCode, ")", ", Entry = ", Price, ", Target = ", TargetPrice, ", Stop = ", StopPrice, ", Current Bid = ", Bid, ", Current Ask = ", Ask); Sleep(SLEEP_ERR);
return (-1); }
//+------------------------------------------------------------------+ //| Performs system initialisation | //+------------------------------------------------------------------+ void InitSystem() { Running = FALSE;
RefreshRates(); LastBid = Bid; LastAsk = Ask;
Initialized = TRUE; }
//+------------------------------------------------------------------+ //| Checks for entry to a trade | //+------------------------------------------------------------------+ int CheckEntry(double Size) { LongOrder = Order(Symbol(), OP_BUY, Ask, Size, Ask + (Points * ProfitTarget), Bid - (Points * StopLoss)); ShortOrder = Order(Symbol(), OP_SELL, Bid, Size, Bid - (Points * ProfitTarget), Ask + (Points * StopLoss)); if ((LongOrder > 0) && (ShortOrder > 0)) return(1); else return(0); }
//+------------------------------------------------------------------+ //| Checks for exit from a trade | //+------------------------------------------------------------------+ int CheckExit() { int ErrorCode;
if (OrderSelect(LongOrder, SELECT_BY_TICKET) != TRUE) { ErrorCode = GetLastError(); Print("Error selecting order ", LongOrder, ": ", ErrorDescription(ErrorCode), " (", ErrorCode, ")"); return(-1); } else if (OrderCloseTime() > 0) { Print("Order ", LongOrder, " closed: ", OrderClosePrice(), ", at ", TimeToStr(OrderCloseTime())); UpdateOrder(ShortOrder, 0, 0); return(1); }
if (OrderSelect(ShortOrder, SELECT_BY_TICKET) != TRUE) { ErrorCode = GetLastError(); Print("Error selecting order ", ShortOrder, ": ", ErrorDescription(ErrorCode), " (", ErrorCode, ")"); return(-1); } else if (OrderCloseTime() > 0) { Print("Order ", ShortOrder, " closed: ", OrderClosePrice(), ", at ", TimeToStr(OrderCloseTime())); UpdateOrder(LongOrder, 0, 0); return(1); } return(0); }
//+------------------------------------------------------------------+ //| Expert initialization function | //+------------------------------------------------------------------+ int init() { Dig = MarketInfo(Symbol(), MODE_DIGITS); Points = MarketInfo(Symbol(), MODE_POINT);
Print("Digits = ", Dig, ", Points = ", DoubleToStr(Points, 5));
if (!IsDemo() && !IsTesting()) { MessageBox("Wealth Warning! This expert is for educational purposes only." + " It should NEVER be used on a live account." + " Past performance is in no way indicative of future results!"); Print("Initialization Failure"); return(-1); }
InitSystem();
Print("Initialized OK");
return(0); }
//+------------------------------------------------------------------+ //| Expert deinitialization function | //+------------------------------------------------------------------+ int deinit() { Print("DeInitialized OK");
return(0); }
//+------------------------------------------------------------------+ //| Expert start function | //| Executed on every tick | //+------------------------------------------------------------------+ int start() { if (!Initialized) { return(-1); } else if (Running) { // Are we in a trade at the moment? if (CheckExit() > 0) { // Yes - Last trade complete? Initialized = FALSE; // Yes - Indicate we need to reinitialise InitSystem(); // and start all over again! } } else { if (CheckEntry(Lots) > 0) { // Entered a trade? Running = TRUE; // Yes - Indicate that we're in a trade } } return(0); }
You can also download the source code here.
Leave a Comment