Hello,
I have a timer function that works fine but I want a comment in the upper corner of the chart that says someting like this when the EA runs:
"Trade allowed between xx and xx"
I've tried to add the Comment() function but I cant place it right without errors..
For example like this just to keep it simple. I'm not shure where to put the comment or where to put the semicolon or braces correct.//Timer if(UseTimer == true) Comment("Timerfunction on"); { if((Hour() >= OpenHour && Minute() >= OpenMinute && (Hour() <= EndHour && Minute()<= EndMinute))) { bool TradeAllowed = true; } else TradeAllowed = false; } else TradeAllowed = true;
For example like this just to keep it simple. I'm not shure where to put the comment or where to put the semicolon or braces correct.
Well maybe you should learn ? Book
//Timer if(UseTimer == true) { Comment("Timerfunction on"); if((Hour() >= OpenHour && Minute() >= OpenMinute && (Hour() <= EndHour && Minute()<= EndMinute))) { bool TradeAllowed = true; } else TradeAllowed = false; } else TradeAllowed = true;
ok, thanks. I'm learning and have started reading the articles from forex-tsd.com. Just one more thing: If I use the Comment function more than one time it only shows the last comment. After I added the timerfunction comment my comment over disappeared. Is there a way I can make them all show in the chart?
if(comment){Comment( "Daglig 8 Ema="+EMA8+ "\nDaglig 21 Ema="+EMA21+ "\nDaglig 50 Ema="+EMA50+ "\nDaglig 100 Ema="+EMA100+ "\nDaglig 200 Ema="+EMA200+ "\nDaglig ATR ="+ATR+ "\nDaglig Rsi ="+Rsi+ "\nDailyHigh ="+DailyHigh+ "\nDailyLow ="+DailyLow+ "\nDailyRange ="+DailyRange+ "\nTotalOrders ="+TotalOrders+ "\nWeekDay ="+WeekDay+ "\nYearDay ="+YearDay);} //Timer if(UseTimer == true) {Comment("\nTimerfunction on"); if((Hour() >= OpenHour && Minute() >= OpenMinute && (Hour() <= EndHour && Minute()<= EndMinute))) { bool TradeAllowed = true; } else TradeAllowed = false; } else TradeAllowed = true;
ok, thanks. I'm learning and have started reading the articles from forex-tsd.com. Just one more thing: If I use the Comment function more than one time it only shows the last comment. After I added the timerfunction comment my comment over disappeared. Is there a way I can make them all show in the chart?
int start() { //.................... //---- if (ShowComment) subPrintDetails(); //---- return(0); } //+------------------------------------------------------------------+ //----------------------- PRINT COMMENT FUNCTION void subPrintDetails() { string sComment = ""; string sp = "----------------------------------------\n"; string NL = "\n"; sComment = "Server Time: " + TimeToStr(TimeCurrent(), TIME_SECONDS) + NL; sComment = sComment + NL; sComment = sComment + "Daglig 8 Ema= " + EMA8 + NL; sComment = sComment + "Daglig 21 Ema= " + EMA21 + NL; sComment = sComment + "Daglig 50 Ema= " + EMA50 + NL; sComment = sComment + "Daglig 100 Ema= " + EMA100 + NL; sComment = sComment + "Daglig 200 Ema= " + EMA200 + NL; sComment = sComment + "Daglig ATR = " + ATR + NL; sComment = sComment + "Daglig Rsi = " + Rsi + NL; sComment = sComment + "DailyHigh = " + DailyHigh + NL; sComment = sComment + "DailyLow = " + DailyLow + NL; sComment = sComment + "DailyRange = " + DailyRange + NL; sComment = sComment + "TotalOrders = " + TotalOrders + NL; sComment = sComment + "WeekDay = " + WeekDay + NL; sComment = sComment + "YearDay = " + YearDay + NL; //Timer if(UseTimer == true) { sComment = sComment + sp; sComment = sComment + "Timerfunction on"; } Comment(sComment); } //+------------------------------------------------------------------+
maybe this way for example
make also in beginning line double EMA8,EMA21,....; int TotalOrders,....; (not declare it after start)
for backtesting it is not needed to print comment set showcomment false if you like to backtest with more speed
ok, thanks. I'm learning and have started reading the articles from forex-tsd.com. Just one more thing: If I use the Comment function more than one time it only shows the last comment. After I added the timerfunction comment my comment over disappeared. Is there a way I can make them all show in the chart?
Great!! Thank you both, I really appreciate your help. I have used the comment function and its great. I have also implemented som other useful information. It took me some time to make a fuction that calculates winners and loosers but I had to really try before asking for help again.
Now i will try the same using objects since its more flexible and fancy:-)
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hello,
I have a timer function that works fine but I want a comment in the upper corner of the chart that says someting like this when the EA runs:
"Trade allowed between xx and xx"
I've tried to add the Comment() function but I cant place it right without errors..