My Auto-trading scripts

Studies that have been contributed to the community by other users. If you’ve got something useful to share, that’s great!
User avatar
Smoky
Posts: 505
Joined: 03 Dec 2010
Location: Thailand
Has thanked: 96 times
Been thanked: 115 times

My Auto-trading scripts

Postby Smoky » 27 Jun 2018

we are some auto-trader here and i want to share my scripts and tools to make some automation.

I use these tools,

1) Autohotkey to run script as an exe
https://www.autohotkey.com/download/


2) Greenshot freeware to take screenshot for MC support (if need)
http://getgreenshot.org/



this first script allow auto-trading (first MC popup Windows when auto-trading workspaces are loading)

Code: Select all

;#NoTrayIcon
DetectHiddenWindows, On
DetectHiddenText, On
SetTitleMatchMode, 1

While 1
{
; Allow autotrading first popup
IfWinExist, Do You want to enable Auto-Trading for next strategies:
{
Sleep 2
WinActivate, Do You want to enable Auto-Trading for next strategies:
;MsgBox, Windows trouvee
Send,{enter} ; Yes BUTTON default Button only Yes / No
Break
}
}
Exit
this second script allow account validation (for each account / strategy ) infinite Loop for all charts / all workspaces

Code: Select all

;#NoTrayIcon
DetectHiddenWindows, On
DetectHiddenText, On
SetTitleMatchMode, 1

;comment start with ; this script allow autotrading without any user in front of screen
;great in full autotrading on VPS

While 1
{
IfWinExist, Warning
{
Sleep 5
WinActivate, Warning
;Popupwindows to confirm autotrading account on screen
;Sleep 5
;Send,{PrintScreen} ; make PrintScreen with Greenshot freeware for futur use
Sleep 5
Send,{enter} ; send Enter on Yes button (default button) only two buttons Yes / No
}
}
Exit
this script allow Quotemanager to restart when an error occur and run as an auto-skip button,
then Quotemanager start again and our stategy have quotes to run again. (You loose only few dataquotes)

Code: Select all

;#NoTrayIcon
DetectHiddenWindows, On
DetectHiddenText, On
SetTitleMatchMode, 1

While 1
{
IfWinExist, Application Error
{
Sleep 5
WinActivate, Application Error
;windows popup "Application Error"
Sleep 5
Send,{PrintScreen} ; screenshoot for MC support use
Sleep 5
Send,{tab} ; go to skip button with Tab Key
Sleep 5
Send,{enter} ; Keypress on Skip BUTTON to restart QM
}
}
Exit

;every time an error occur a screenshoot with name,date,heure
;will be archived by GreenShot freeware
Today all scripts are running good but with no guarantee for the futur, if new version of MC change name of popup windows,
add other popup, change defaut button or add button on popup, they will stop to work.

You can also make a big script to manage all since Server startup.

Next step will be to make another script to "Flush Cached Data to Database" (with MC 12)
after a trading day without closing QuoteManager and all will be ready for next trading day.
MC is ready to wait first tick of the next day to run again...
(Reboot Server only on week end LoL)

nota: Sleep value can change from Server to another Server with faster CPU


my new script to flush QM

Code: Select all

WinGet, active_id, ID, MultiCharts64 QuoteManager
WinActivate, ahk_id %active_id%

SendInput {Ctrl Down}{b Down}
Sleep 50
SendInput {b Up}{Ctrl Up}

Sleep 1000

WinMinimize, ahk_id %active_id%
and with timer to flush at 23:00

Code: Select all

#Persistent
SetTimer, TimeCheck, 3600000 ; check every hour
return

TimeCheck:
If (A_Hour=23)

WinGet, active_id, ID, MultiCharts64 QuoteManager
WinActivate, ahk_id %active_id%

SendInput {Ctrl Down}{b Down}
Sleep 50
SendInput {b Up}{Ctrl Up}

Sleep 1000

WinMinimize, ahk_id %active_id%

return

Jupp25
Posts: 50
Joined: 17 Sep 2021
Has thanked: 13 times
Been thanked: 7 times

Re: My Auto-trading scripts

Postby Jupp25 » 01 Dec 2022

Hi,

I would like to use the script "Flush to Database", but I cant even compile it.
Is there a newer/different version out there?

Thx
Chris

User avatar
Smoky
Posts: 505
Joined: 03 Dec 2010
Location: Thailand
Has thanked: 96 times
Been thanked: 115 times

Re: My Auto-trading scripts

Postby Smoky » 12 Dec 2022

Hi,

I would like to use the script "Flush to Database", but I cant even compile it.
Is there a newer/different version out there?

Thx
Chris
Compil this code please:

Code: Select all

#Persistent SetTimer, TimeCheck, 3600000 ; 3600000 check every hour 60000 EVERY MINUTE return TimeCheck: SoundBeep, 300, 1000 WinGet, active_id, ID, MultiCharts64 QuoteManager WinActivate, ahk_id %active_id% SendInput {Ctrl Down}{b Down} Sleep 50 SendInput {b Up}{Ctrl Up} Sleep 1000 WinMinimize, ahk_id %active_id% return
it's working on my side


Return to “User Contributed Studies and Indicator Library”