• Home
  • Forums
  • Trades
  • News
  • Calendar
  • Market
  • Brokers
  • Login
  • Join
  • User/Email: Password:
  • 10:23am
Menu
  • Forums
  • Trades
  • News
  • Calendar
  • Market
  • Brokers
  • Login
  • Join
  • 10:23am
Sister Sites
  • Metals Mine
  • Energy EXCH
  • Crypto Craft

Options

Bookmark Thread

First Page First Unread Last Page Last Post

Print Thread

Similar Threads

How to scroll through charts loading one bar at a time? 12 replies

Need to simultaneously scroll multiple charts on MT4 6 replies

Lock and Scroll All Charts at the same time 0 replies

I lost my ability to click my scroll wheel button and get the crosshairs? 9 replies

Tradexecutioner Scroll Problem 2 replies

  • Platform Tech
  • /
  • Reply to Thread
  • Subscribe
Tags: Scroll charts via script
Cancel

Scroll charts via script

  • Post #1
  • Quote
  • First Post: Jul 4, 2008 8:07am Jul 4, 2008 8:07am
  •  JackSpade
  • | Joined Jan 2006 | Status: Member | 21 Posts
Hello,

I was looking for a way to automatically go through my trading history and open a chart for each trade, scroll it to the position of the trade entry and highlight the entry/exit. Then I could print the charts out for looking at.

I cant find any way to do this via pure mql (maybe Im wrong there though?) Maybe its possible to do it via importing the windows dlls and sending WM_SCROLL to the charts? but I dont know how to open the charts.....

Anyone think of a way I could do this ?
  • Post #2
  • Quote
  • Edited 4:33pm Jul 4, 2008 9:56am | Edited 4:33pm
  •  Kenz987
  • Joined Aug 2006 | Status: Member | 737 Posts
Maybe: Open any chart manually. From a VB or other program (perhaps even vbs script) use SendKeys to change the chart. Send an "Enter" to give you the open dialog, Then send enough backspaces to clear it out, then send the pair "EURUSD,1" etc, Then "Enter" again. This gets the chart open. Then send "Page-Up" to scroll backwards. You will have to coordinate with an indicator to know when to stop scrolling backward. Then use more sendkeys to File...Print etc. If you can put this into a DLL then it might work a lot cleaner. I've heard this will not work in the new improved Vista. This would probably be much easier in ninja since you have all the functionality of C# to work with.

ps: Just found this link from somewhere else in this forum (don't remember where now, but Thanks to the poster):
http://www.metatrader.info/node/160
It shows how to call user32 for keyboard functions. May be easier than going from VB, or may give you some ideas.
 
 
  • Post #3
  • Quote
  • Jul 5, 2008 1:05pm Jul 5, 2008 1:05pm
  •  JackSpade
  • | Joined Jan 2006 | Status: Member | 21 Posts
Thanks Kenz987, thats the sort of thing I was thinking about for scrolling the chart, hadnt thought of using it to send keys like that. If I come up with anything decent Ill post it on here.
 
 
  • Post #4
  • Quote
  • Jul 5, 2008 4:16pm Jul 5, 2008 4:16pm
  •  Kenz987
  • Joined Aug 2006 | Status: Member | 737 Posts
See my prior post for Frank above.
http://www.forexfactory.com/showthread.php?t=94603
I'm into api calls right now - didn't know all this was available inside MT. I think what you want to do can be done even easier than my prior post. I'll get back to you. Ken.
ps: Is there a keyboard command to get the Statement output to a text file?
 
 
  • Post #5
  • Quote
  • Jul 5, 2008 7:16pm Jul 5, 2008 7:16pm
  •  pippero
  • | Joined Oct 2007 | Status: Trend following is for teens | 216 Posts
dunno about the statement file, but you can definitely scroll charts programmatically.

Find the window handle using WindowHandle() and then issue either sendMessage or PostMessage calls to it, sending the key code for the cursor keys.

I think there actually is an example on the mql4.com forums.
 
 
  • Post #6
  • Quote
  • Jul 6, 2008 10:44am Jul 6, 2008 10:44am
  •  JackSpade
  • | Joined Jan 2006 | Status: Member | 21 Posts
Ive been thinking about htis since Ken posted about sending key strokes. It would be quite hard to know where to scroll the chart to, could probably be done but would be a bit complicated and messy I think....

However, it could be done quite easily using Kens idea and sending a spacebar to the chart and then a date string as key presses to get it to the opening bar of the trade from the history.

One problem is knowing what timeframe to set the chart to as I cant remember what timeframe I entered all my trades on... I think I would remember though if I flicked through a few timeframes, probably.

Heres a bit of pseudo code:

Inserted Code
Loop through closed trades:
   Create a datetime string for open time of trade;
   Open chart for Symbol();
   Send space + datetime string to chart;
   Somehow get arrows on the chart showing trade entry/exit;

Then manually mess around with timeframe to create a chart for printing out.
 
 
  • Post #7
  • Quote
  • Jul 6, 2008 11:24am Jul 6, 2008 11:24am
  •  Kenz987
  • Joined Aug 2006 | Status: Member | 737 Posts
Yes Jack, progress is being made. I'm learning quite a lot about the user32 api and I have ideas for doing your scroll. This will take me some time, perhaps another weekend to test. Ken.
 
 
  • Post #8
  • Quote
  • Last Post: Jul 8, 2008 7:47am Jul 8, 2008 7:47am
  •  Kenz987
  • Joined Aug 2006 | Status: Member | 737 Posts
Jack, would you be willing to have Excel control this?
 
 
  • Platform Tech
  • /
  • Scroll charts via script
  • Reply to Thread
0 traders viewing now
Top of Page
  • Facebook
  • Twitter
About FF
  • Mission
  • Products
  • User Guide
  • Media Kit
  • Blog
  • Contact
FF Products
  • Forums
  • Trades
  • Calendar
  • News
  • Market
  • Brokers
  • Trade Explorer
FF Website
  • Homepage
  • Search
  • Members
  • Report a Bug
Follow FF
  • Facebook
  • Twitter

FF Sister Sites:

  • Metals Mine
  • Energy EXCH
  • Crypto Craft

Forex Factory® is a brand of Fair Economy, Inc.

Terms of Service / ©2023