Incorrect MarketInfo in BackTesting
Posted: Tue Apr 26, 2016 9:11 pm
Hello,
I'm having trouble pulling MarketInfo data when using tickstory for backtesting. I'm trying to use the MarketInfo(Symbol(),MODE_TICKVALUE) to calculate risk based position sizes.
However the tick value just is always just returned as "1.0" which I think is set in the "export to MT4" options window when outputting the data. I want metatrader to pull this value from the brokers server so I can calculate position sizes correctly. The strange thing is that in the results the correct tick value is used to calculate profit and loss on each trade. It just doesn't show correctly if I try to reference and print it with MarketInfo(Symbol(),MODE_TICKVALUE).
Is this how it is supposed to work? Is there a way to get MarketInfo to pull the same data being used calculate the profit/losses?
As an example...
I am running a backtest on GBPNZD. I exported to MT4 using a tickvalue of 1.0. If I run "Print("MarketInfo(Symbol(),MODE_TICKVALUE))" in strategy tester it returns the value of "1.0".
If I run a script with the "Print("MarketInfo(Symbol(),MODE_TICKVALUE))" on a live chart in the terminal it returns "0.68955".
I run my strategy test and look at the number of pips, and the value of profit in the results window. If I back calculate the tick value used to calculate the profit it works out at 0.68982. This actually changes over time, so if I calculate on trades at different times in the history it's different as the exchange rates change.
I could set the value myself when exporting the data, but I want to ensure I am using the same value as the profit/loss calculator is, which appears to change over time.
I'm having trouble pulling MarketInfo data when using tickstory for backtesting. I'm trying to use the MarketInfo(Symbol(),MODE_TICKVALUE) to calculate risk based position sizes.
However the tick value just is always just returned as "1.0" which I think is set in the "export to MT4" options window when outputting the data. I want metatrader to pull this value from the brokers server so I can calculate position sizes correctly. The strange thing is that in the results the correct tick value is used to calculate profit and loss on each trade. It just doesn't show correctly if I try to reference and print it with MarketInfo(Symbol(),MODE_TICKVALUE).
Is this how it is supposed to work? Is there a way to get MarketInfo to pull the same data being used calculate the profit/losses?
As an example...
I am running a backtest on GBPNZD. I exported to MT4 using a tickvalue of 1.0. If I run "Print("MarketInfo(Symbol(),MODE_TICKVALUE))" in strategy tester it returns the value of "1.0".
If I run a script with the "Print("MarketInfo(Symbol(),MODE_TICKVALUE))" on a live chart in the terminal it returns "0.68955".
I run my strategy test and look at the number of pips, and the value of profit in the results window. If I back calculate the tick value used to calculate the profit it works out at 0.68982. This actually changes over time, so if I calculate on trades at different times in the history it's different as the exchange rates change.
I could set the value myself when exporting the data, but I want to ensure I am using the same value as the profit/loss calculator is, which appears to change over time.