molanis.com/forum - Tools for MetaTrader : The place to ask about the best expert advisor builder, expert advisor downloads, and expert advisor programming

AFTER YOU REGISTER SEND US AN EMAIL TO ACTIVATE YOUR ACCOUNT - Before posting:-1- Please read the user guide -2- Try the examples -3- Search in the forum
It is currently Sat May 11, 2024 5:11 am

All times are UTC - 5 hours




Post new topic Reply to topic  [ 5 posts ] 
Author Message
 Post subject: Comment() -or- Print()?
PostPosted: Thu Apr 19, 2012 4:02 pm 
Offline

Joined: Wed Mar 14, 2012 12:31 am
Posts: 118
Hello,

Is it possible to use either the Comment(), or the Print() functions in MQL, to display the output from an MQL Block on the chart? In other words, can you Comment or Print the return value from an MQL Block, to the screen?

I have created an MQL Block that sets a condition. The condition is actually a Price Level. I'd like to be able to see that Price Level on the chart while the EA is running, so that I can see how the market price interacts with the condition contained in the MQL Block.

Either a Line drawn at the level of the condition itself, or simply displaying the value in numeric from (1.59543) of the condition within the MQL Block. Either solution would help me to visualize what the market is actually doing, relative to the EA.

Thanks,
cfx


Top
 Profile  
 
 Post subject: Re: Comment() -or- Print()?
PostPosted: Thu Apr 19, 2012 4:20 pm 
Offline

Joined: Tue Dec 22, 2009 12:22 am
Posts: 1761
In metatrader Lines are more difficult since you need to manage object and indicators.
Comment will be your best option -- maybe you can add it at the end of your code that gets the price, use some time info to see when the data is obtained.
Something like
Comment("Molanis: Price:",pricevar," starts running at: Server Time=",TimeToStr(TimeCurrent(),TIME_DATE|TIME_SECONDS)," Terminal Time=",TimeToStr(TimeLocal(),TIME_DATE|TIME_SECONDS));


Top
 Profile  
 
 Post subject: Re: Comment() -or- Print()?
PostPosted: Fri Apr 20, 2012 4:58 pm 
Offline

Joined: Wed Mar 14, 2012 12:31 am
Posts: 118
molanisfx wrote:
In metatrader Lines are more difficult since you need to manage object and indicators.
Comment will be your best option -- maybe you can add it at the end of your code that gets the price, use some time info to see when the data is obtained.
Something like
Comment("Molanis: Price:",pricevar," starts running at: Server Time=",TimeToStr(TimeCurrent(),TIME_DATE|TIME_SECONDS)," Terminal Time=",TimeToStr(TimeLocal(),TIME_DATE|TIME_SECONDS));



Ok, I placed Comment("Molanis: Price:",pricevar," starts running at: Server Time=",TimeToStr(TimeCurrent(),TIME_DATE|TIME_SECONDS)," Terminal Time=",TimeToStr(TimeLocal(),TIME_DATE|TIME_SECONDS)); directly into the MQL Block, right at the end of the code (as you suggested) and of course, the MQL block would not validate the code as being correct. I removed the segment of code you just gave me and the MQL block went back to validate as "OK".

So, I've got an MQL Block that works perfectly, but apparently I have no way to actually use the output that it generates. I think this really does go back to my suggestion of further integrating the MQL Blocks into Strategy Builder.

It would be really supportive to the trader, if you could easily display the value from an MQL Block within a chart, using any number of graphic elements (lines, arrows, etc.), and be able to use that same value within any TA+ Block as one of its operands.

I was able to create the output from the MQL Block using Excel, and it took roughly 30 minutes to finish:

Image

Both values (BuyZone and SellZone) are what I need painted on screen:
Image

It was really simple to do in Excel. If there was a way to both paint the chart with the value, and use the value in a TA+ Block Operand, it would send the usefulness of Strategy Builder through the roof for me as a trader. Think about what it does. It allows the trader to create custom trade logic and then use and display the output from that custom logic, within the EA itself. That really does open the door for traders to do some pretty amazing things with Strategy Builder.

Right now, you are unable to access or use that output within a TA+ Block, nor can you easily display the output from an MQL Block on the chart.

Hopefully, this gives you some hints about ways in which MQL Blocks could be more integrated within SB overall.

Thanks for the help!
cfx


Top
 Profile  
 
 Post subject: Re: Comment() -or- Print()?
PostPosted: Fri Apr 20, 2012 6:56 pm 
Offline

Joined: Tue Dec 22, 2009 12:22 am
Posts: 1761
You cannot copy the code as we posted it here. It was just an example of how you should do things, just to give you an idea. We have no clue how your code works so we cannot give you code to copy/paste.
If you paste the code it will fail because it calls a variable pricevar - you need to use your own variable to show the price or put your own code there
Comment("Molanis: Price:",pricevar," starts running at: Server Time=",TimeToStr(TimeCurrent(),TIME_DATE|TIME_SECONDS)," Terminal Time=",TimeToStr(TimeLocal(),TIME_DATE|TIME_SECONDS));

Unfortunately we cannot go into explaining mql since we try to keep the focus of the forum to product support and don't want to go into development.


Top
 Profile  
 
 Post subject: Re: Comment() -or- Print()?
PostPosted: Mon Apr 23, 2012 10:00 am 
Offline

Joined: Wed Mar 14, 2012 12:31 am
Posts: 118
Not a problem - I'll just skip this method while using Molanis, and try to accomplish the same thing by some other means. It was for testing purposes, so I could be able to visualize the Buy and Sell zones on the MT4 chart. It works fine in Excel as usual, but Excel does not have streaming data from MT4 unless I use something like TradeInterceptor, or FxDialougue. But, I would have to maintain two simultaneous development paths at the same time, if I did that.

Thanks for trying to help, however.

cfx


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 5 posts ] 

All times are UTC - 5 hours


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by Molanis © 2009