NexusFi: Find Your Edge


Home Menu

 





one mouse click = multiple programs' actions


Discussion in Tech Support

Updated
      Top Posters
    1. looks_one SARdynamite with 6 posts (1 thanks)
    2. looks_two DobermanTrading with 2 posts (1 thanks)
    3. looks_3 SatchFan with 1 posts (0 thanks)
    4. looks_4 ratfink with 1 posts (3 thanks)
    1. trending_up 1,893 views
    2. thumb_up 5 thanks given
    3. group 2 followers
    1. forum 8 posts
    2. attach_file 2 attachments




 
Search this Thread

one mouse click = multiple programs' actions

  #1 (permalink)
 SARdynamite 
Belgium
 
Experience: Advanced
Platform: SaxoTrader
Broker: SaxoBank
Trading: ESTX
Posts: 289 since Dec 2009
Thanks Given: 243
Thanks Received: 110

Under Windows 10 here,

What I would like to achieve, put it simply, by one single mouse click, it would trigger buy/sell market button cliks on different trading platformss (3-4 of them), paneled side by side. Ideally at the same time, with the least delay...

Can you think of the best trick to realise such task ?

thanks a lot

Started this thread Reply With Quote

Can you help answer these questions
from other members on NexusFi?
Pivot Indicator like the old SwingTemp by Big Mike
NinjaTrader
How to apply profiles
Traders Hideout
ZombieSqueeze
Platforms and Indicators
Cheap historycal L1 data for stocks
Stocks and ETFs
About a successful futures trader who didn´t know anyth …
Psychology and Money Management
 
  #2 (permalink)
 DobermanTrading 
SE Asia / Canada
 
Experience: Intermediate
Platform: FXCM's Trading Station
Broker: Darwinex, FXCM, Tradingview
Trading: Forex and CFD's
Posts: 114 since Jun 2010
Thanks Given: 26
Thanks Received: 109

Hi,

Maybe try to keybind buy/sell actions with your different platforms with independent macro keys on gaming mouse/keyboard type ?




cheers,

Totantaz

Follow me on Twitter Visit my NexusFi Trade Journal Reply With Quote
Thanked by:
  #3 (permalink)
 SARdynamite 
Belgium
 
Experience: Advanced
Platform: SaxoTrader
Broker: SaxoBank
Trading: ESTX
Posts: 289 since Dec 2009
Thanks Given: 243
Thanks Received: 110


With bindings, will there not be a windows focus problem ?

My main platform has PS4/XBOX controller and keyboard trading enabled, NT8 has keyboard too, however two other platform I use support only mouse click, hence I would need to focus on simulated simultaneous mouse clicks really

Maybe someone has wrote scripts with AutoHotkey or else, I am not sure

Started this thread Reply With Quote
  #4 (permalink)
 DobermanTrading 
SE Asia / Canada
 
Experience: Intermediate
Platform: FXCM's Trading Station
Broker: Darwinex, FXCM, Tradingview
Trading: Forex and CFD's
Posts: 114 since Jun 2010
Thanks Given: 26
Thanks Received: 109

hmmm... Does your other platforms support mouse-3 and mouse-4 type buttons ?

i would be scared of using left and right clicks by error hehe

Follow me on Twitter Visit my NexusFi Trade Journal Reply With Quote
  #5 (permalink)
 SARdynamite 
Belgium
 
Experience: Advanced
Platform: SaxoTrader
Broker: SaxoBank
Trading: ESTX
Posts: 289 since Dec 2009
Thanks Given: 243
Thanks Received: 110

Neh ! It is just for the needs of an experiment, will pay attention

Started this thread Reply With Quote
  #6 (permalink)
 
SatchFan's Avatar
 SatchFan 
Jefferson City, Missouri
 
Experience: Intermediate
Platform: NinjaTrader
Broker: NinjaTrader Brokerage
Trading: CL ES
Posts: 223 since Mar 2010
Thanks Given: 329
Thanks Received: 205

I would try using AutoHotKey.

Reply With Quote
  #7 (permalink)
 
ratfink's Avatar
 ratfink 
Birmingham UK
Market Wizard
 
Experience: Intermediate
Platform: NinjaTrader
Broker: TST/Rithmic
Trading: YM/Gold
Posts: 3,633 since Dec 2012
Thanks Given: 17,423
Thanks Received: 8,426


SARdynamite View Post
Under Windows 10 here,

What I would like to achieve, put it simply, by one single mouse click, it would trigger buy/sell market button cliks on different trading platformss (3-4 of them), paneled side by side. Ideally at the same time, with the least delay...

Can you think of the best trick to realise such task ?

thanks a lot

Low level .Net routines and variables allow most things, I use this a lot under NT7/Windows7, I can't see why it would be a problem under later versions of either. Using separate thread(s) is also best to get decent timings and avoid any main NT thread clash or holdup. Google will find you anything that you need if you are happy to do it in C#.

e.g. a simple utility using the Windows 'mouse_event' function and the Cursor variable that I use:

 
Code
		[DllImport("user32.dll")]
		static extern void mouse_event(uint dwFlags, uint dx, uint dy, uint dwData, UIntPtr dwExtraInfo);   
		
		private void ClickPoint(Point pt)
		{
			ClickPoint(pt, 75);
		}
			
		private void ClickPoint(Point pt, int delay)
		{
			if (showClicks) Print("ClickPoint " + pt + "  " + delay);
			
			if (falseClicks) return;

			// set cursor on coords, and press mouse
			
			Cursor.Position = pt;
			Thread.Sleep(25);
						
			mouse_event(0x00000002, 0, 0, 0, UIntPtr.Zero); /// left mouse button down
			mouse_event(0x00000004, 0, 0, 0, UIntPtr.Zero); /// left mouse button up

			if (delay != 0) Thread.Sleep(delay);
		}
Note that points are in screen pixels in a global space across all monitors relative to topleft on the main monitor, +ve and -ve in both directions. 'showClicks' and 'falseClicks' are just diagnostic booleans.

Plenty of ways to handle focus issues either with system routines or calling the click routine on another area of the window(s).

Cheers

Travel Well
Visit my NexusFi Trade Journal Reply With Quote
Thanked by:
  #8 (permalink)
 SARdynamite 
Belgium
 
Experience: Advanced
Platform: SaxoTrader
Broker: SaxoBank
Trading: ESTX
Posts: 289 since Dec 2009
Thanks Given: 243
Thanks Received: 110

Interesting. Thanks


SatchFan View Post
I would try using AutoHotKey.

Here is something with AutoIt

 
Code
HotKeySet("{ESC}", "_exit")
HotKeySet("{F10}", "_secondMouse")
$mouse = MouseGetPos()
$dll = DllOpen("user32.dll")
$toggle = 0
#include <Misc.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <EditConstants.au3>
#include <StaticConstants.au3>
$MiceX2 = GUICreate("MiceX2", 184, 92, 192, 124)
$xDistanceInput = GUICtrlCreateInput("200", 128, 0, 49, 21)
$xInfoLabel = GUICtrlCreateLabel("X Distance from Mouse", 8, 4, 114, 17)
$yInfoLabel = GUICtrlCreateLabel("Y Distance from Mouse", 8, 28, 114, 17)
$yDistanceInput = GUICtrlCreateInput("0", 128, 24, 49, 21)
$hotkeyInfo1 = GUICtrlCreateLabel("Start = F10", 16, 48, 83, 17)
$hotkeyInfo1 = GUICtrlCreateLabel("Stop = F9", 16, 64, 83, 17)
$hotkeyInfo2 = GUICtrlCreateLabel("Exit = ESC", 16, 78, 54, 17)
GUISetState(@SW_SHOW)
Opt("GUIOnEventMode", 1) ; Change to OnEvent mode
GUISetOnEvent($GUI_EVENT_CLOSE, "_exit")
_load()
While 1
    Sleep(100)
WEnd

Func _secondMouse()
    While 1
        Sleep(25)
        $mouse = MouseGetPos()
        ToolTip("^", $mouse[0] + GUICtrlRead($xDistanceInput) - 10, $mouse[1] + GUICtrlRead($yDistanceInput))
        If _IsPressed("01", $dll) Then _mouseClick()
        If _IsPressed("1B", $dll) Then
            _save()
            Exit
        EndIf
        If _IsPressed("78", $dll) Then
            ToolTip("")
            ExitLoop
        EndIf
    WEnd
EndFunc   ;==>_secondMouse



Func _mouseClick()
    ToolTip("")
    MouseUp("left")
    MouseMove($mouse[0] + GUICtrlRead($xDistanceInput), $mouse[1] + GUICtrlRead($yDistanceInput), 0)
    MouseDown("left")
    Sleep(50)
    MouseUp("left")
    MouseMove($mouse[0], $mouse[1], 0)
    ToolTip("^", $mouse[0] + GUICtrlRead($xDistanceInput), $mouse[1] + GUICtrlRead($yDistanceInput))

EndFunc   ;==>_mouseClick



Func _exit()
    DllClose($dll)
    _save()
    Exit
EndFunc   ;==>_exit

Func _save()
    IniWrite(@ScriptDir & "\MouseX2.ini", "Distance", "X", GUICtrlRead($xDistanceInput, 1))
    IniWrite(@ScriptDir & "\MouseX2.ini", "Distance", "Y", GUICtrlRead($yDistanceInput, 1))
EndFunc   ;==>_save

Func _load()
    GUICtrlSetData($xDistanceInput, IniRead(@ScriptDir & "\MouseX2.ini", "Distance", "X", "200"))
    GUICtrlSetData($yDistanceInput, IniRead(@ScriptDir & "\MouseX2.ini", "Distance", "Y", "0"))
EndFunc   ;==>_load

Started this thread Reply With Quote
Thanked by:
  #9 (permalink)
 SARdynamite 
Belgium
 
Experience: Advanced
Platform: SaxoTrader
Broker: SaxoBank
Trading: ESTX
Posts: 289 since Dec 2009
Thanks Given: 243
Thanks Received: 110

Regarding the last AutoIt script, I tried to adapt it to make it a triple cursor/click instead of double
However the cursor markers are blinking and fading out of sight most of the time.

Can anyone familiar with AutoIt give it a quick try (to make it triple cursor/click) ? I'd be grateful!

Started this thread Reply With Quote




Last Updated on November 4, 2015


© 2024 NexusFi™, s.a., All Rights Reserved.
Av Ricardo J. Alfaro, Century Tower, Panama City, Panama, Ph: +507 833-9432 (Panama and Intl), +1 888-312-3001 (USA and Canada)
All information is for educational use only and is not investment advice. There is a substantial risk of loss in trading commodity futures, stocks, options and foreign exchange products. Past performance is not indicative of future results.
About Us - Contact Us - Site Rules, Acceptable Use, and Terms and Conditions - Privacy Policy - Downloads - Top
no new posts