I just noticed my Journal is showing output starting from Aug 27 when the time for the test was at Aug 24. Is there a limit to how much the journal can display?
satsujin:
Hi,
my trendChange variable is howing up as false even though I set it true at the beginning. It never changes during the whole run. This variable is a string but I tried bool too and it only gave me 0 in the printout. What am I doing wrong?
bool openTrade=false; int ticket; double current,dayLow,dayHigh,pipsToHigh,pipsToLow; double daybefore; string trend; // i.e. trend = ""; string trendChange="true"; //+------------------------------------------------------------------+ //| expert initialization function | //+------------------------------------------------------------------+ int init() { //---- Print("-----------------------------------------------------------"); //---- return(0); } //+------------------------------------------------------------------+ //| expert deinitialization function | //+------------------------------------------------------------------+ int deinit() { //---- //---- return(0); } //+------------------------------------------------------------------+ //| expert start function | //+------------------------------------------------------------------+ int start() { //---- daybefore=iClose("GBPJPY",PERIOD_H4,3); dayHigh=iClose("GBPJPY",PERIOD_H4,0); current=iClose("GBPJPY",PERIOD_H4,0); Print(current,"<---curr db--->",daybefore); if (current > daybefore) { if (trend=="sell") trendChange="true"; // skips, trend = "" trend="buy"; Print("entered buy and tc is ",trendChange); } else { if (trend=="buy") trendChange="true"; // skip, trend = "" trend="sell"; Print("entered sell and tc is ",trendChange); } if (trendChange=="true") // trendChange="true" { Print("Trend is ",trend); // outputs "Trend is " trendChange="false"; // here is your false, while still trend="" }
Skipping while trend="" should not be a problem because trend is set to "buy" or "Sell" immediately afterward. Why is the if test for trendChange == true not executing if I have already set it to true above?
string trend; // i.e. trend = "";
Trend is not equal to "" (The empty string) it is an uninitialized string (NULL) Thus your trend== results in error 4008
WHRoeder:
Trend is not equal to "" (The empty string) it is an uninitialized string (NULL) Thus your trend== results in error 4008
Trend is not equal to "" (The empty string) it is an uninitialized string (NULL) Thus your trend== results in error 4008
I have a different MT4. In mine it initializes accordingly to the docs to an empty string and triggers no error.
Variable Initialization .... If no initial value is set explicitly, a numeric variable will be initialized by zero (0) and a string variable will be initialized by an empty line.
I think it works now that i set the type to static but I'm getting other errors. How do you debug in strategy tester? the journal doesnt print everything and the log file for a few days worth of info can be a huge number of GB!
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
Hi,
my trendChange variable is howing up as false even though I set it true at the beginning. It never changes during the whole run. This variable is a string but I tried bool too and it only gave me 0 in the printout. What am I doing wrong?