Trading Systems Leaders in this forum (automated trading systems) are winning more than 3000 pips in a month (30000$ investing one lot every time). Click here to register and get more information
Anyone can help? Why got false result from backtest ?
Hi CoderGuru,
I have problem from back test at MT4, i want to have reverse signal, while the signal appears,
my code is :
-------------------
Print("Signal Before Check TradeStyle(",TradeStyle,")");
if (Signal == -1) { StrSignal = "ENTRY-SELL"; }
if (Signal == 1) { StrSignal = "ENTRY-BUY"; }
Print("Signal B4 Check TradeStyle : ",StrSignal);
if (TradeStyle == 2) { Signal = -1*Signal; } // THIS IS FOR REVERSE PURPOSE
Print("Signal After Check TradeStyle(",TradeStyle,")");
if (Signal == -1) { StrSignal = "ENTRY-SELL"; }
if (Signal == 1) { StrSignal = "ENTRY-BUY"; }
Print("Signal After Check TradeStyle : ",StrSignal);
--------------------
The TRUE result for TradeStyle = 1 ( value 1 mean Trend Follower ) is :
--------------------
08:08 EURJPY,M1: Signal Before Check TradeStyle(1)
08:08 EURJPY,M1: Signal Before Check TradeStyle : ENTRY-BUY
08:08 EURJPY,M1: Signal After Check TradeStyle(1)
08:08 EURJPY,M1: Signal After Check TradeStyle : ENTRY-BUY
=> THIS RESULT IS RIGHT / TRUE ,
=> TREND RIDER STYLE DIDN'T CHANGE SIGNAL, SO THE RESULT BEFORE AND AFTER CHECK MUST SAME
=> Signal Before Check ENTRY-BUY
=> Signal After check ENTRY-BUY
--------------------
I use same date data and i show the time for let know, that is the same source data, but RESULT IS WRONG !
Below is FALSE result for TradeStyle = 2 ( value 2 mean COUNTER / REVERSE Trend ) is :
--------------------
08:08 EURJPY,M1: Signal Before Check TradeStyle(2)
08:08 EURJPY,M1: Signal Before Check TradeStyle : ENTRY-BUY
08:08 EURJPY,M1: Signal After Check TradeStyle(2)
08:08 EURJPY,M1: Signal After Check TradeStyle : ENTRY-BUY
=> THIS RESULT IS WRONG / FALSE,
=> COUNTER TREND STYLE MUST REVERSE SIGNAL, SIGNAL BEFORE CHECK AND AFTER CHECK MUST REVERSE
=> Signal Before Check ENTRY-BUY
=> Signal After Check ENTRY-BUY => Should ENTRY-SELL
Tools for price/account/trend/ monitoring:
- Trend /Reversal /Continuation HELPER: very improved tool to monitor the price and trades on the chart:The thread with full explanation with Signal_Bars_v2 and up to v6; latest Signal_Bars_v7 is on this thread.
- MarketPrice indicator: the thread.
- Daily Data Window tool: the thread is here.
- Multi-indics indicator: the thread is here.
- !xMeter: the other way to monitor the trades are on this thread.
- indicator to monitor spread and swap is here.
- MultiPositionExpertEA can monitor all your open trades by pips or deposit currency.
- i-Breakeven indicator from RickD is here.
- Tools to analyze the trades: elite section thread with many tools.
- Statement visualization indicators: two indicators are on this post, some more versions are here and here.
- Additional account (orders) information Indicators thread is here.
- Price Display Indicator are on this thread.
- script able to read a statement is on this thread.
- Tickwatcher: A kind of a scaner to monitor trends for multiple pairs and time frames. Original thread.
- Multi pair indicatorsthread: indicators with milti pairs view in one separate window.
- Stoch Signal: thread about good indicator created by cja.
- Bid_View2.0: very informative indicator (separate window) for open/close/spread and others. MTF version (many TF in just one separated window).
- Mt4_FX_Dashboard tool: original thread.
- Trade Assistant - this indicator gives buy and sell signals on multiple timeframes: original thread.
Please, would appreciate a thred to a MTF Stochastic in color with an alert when it crosses the ZERO line, rather than the 20/80 ..
Thanking in advance
The problem is with this line of code.
ObjectSetText("Spread_Label", DoubleToStr(spread,0), 14, "Ariel", Yellow);
When using DoubleToStr the second option is rounding, ie how many decimal places to round to. In your case you are rounding a two or 4 decimal place number back to "Zero" decimal places.
See Below:
string DoubleToStr( double value, int digits)
Returns text string with the specified numerical value converted into a specified precision format.
Parameters:
value - Floating point value.
digits - Precision format, number of digits after decimal point (0-8).
The correct code should read:
ObjectSetText("Spread_Label", DoubleToStr(spread,Digits), 14, "Ariel", Yellow);
NOTE: Digits is an internal function that returns the number of decimal places for the current symbol.