Jump to content

Auto scroll watchlist in Amibroker - (Moved)


Go to solution Solved by Luke94,

Recommended Posts

Hi,

I want AutoIt to scroll through the specified watchlist having stock names in it continuously in technical analysis software Amibroker.    

A utility to auto scroll the charts in the watchlist of Amibroker say every 10-15sec (stopping at each chart for 2sec) so that no need to manually go through each chart. Have no idea about coding so request your help make this utility.

 

Link to comment
Share on other sites

  • Replies 43
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Posted Images

  • Moderators

Moved to the appropriate forum.

Moderation Team

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

Did you use the Finder Tool on the actual list? I would assume it's a ListView. (SysListView32)

Those screenshots are of the column headers.

Use the Finder Tool on some text within the list - Try the scrollbars as well.

You can paste the screenshot directly into your reply, rather than uploading as a document.

Link to comment
Share on other sites

I'm not able to test this but give it a try:

#include <GuiListView.au3>

Global $g_hWnd
Global $g_hListView
Global $g_iCount
Global $g_iIndex

$g_hWnd = WinGetHandle('AmiBroker') ; Get AmiBroker window handle
If IsHWnd($g_hWnd) = 1 Then ; Check the window handle is valid
    If WinActive($g_hWnd) = 0 Then ; Check if AmiBroker is NOT active
        WinActivate($g_hWnd) ; If it's NOT active, activate it
        WinWaitActive($g_hWnd, '', 5) ; Wait for the handle to become active
    EndIf
    While 1 ; Loop forever
        $g_hListView = ControlGetHandle($g_hWnd, '', '[CLASS:SysListView32; INSTANCE:5]') ; Get the ListView handle
        $g_iCount = (_GUICtrlListView_GetItemCount($g_hListView) - 1) ; Get the number of items in the ListView
        $g_iIndex = 0
        Do
            _GUICtrlListView_EnsureVisible($g_hListView, $g_iIndex) ; Scrolls the ListView to the given index - which we're increasing by one below
            $g_iIndex += 1
            Sleep(2000) ; Wait 2000ms (2 seconds)
        Until $g_iIndex > $g_iCount ; Loop until we've reached the end of the ListView
        _GUICtrlListView_EnsureVisible($g_hListView, 0) ; Once we've reached the end of the ListView above, move back to the top of the ListView
        Sleep(15000) ; Wait 15000ms (15 seconds) - once we've waited, the While loop will restart
    WEnd
EndIf

I assume the two screenshots you've sent are different ListViews on different tabs? In that case, the above will only work (if it does) on the currently selected tab. If it does work, we can look into changing the tab periodically. Any errors, post them back. ☺️

Link to comment
Share on other sites

Try this - it should double click each item.

#include <GuiListView.au3>

Global $g_hWnd
Global $g_hListView
Global $g_iCount
Global $g_iIndex

$g_hWnd = WinGetHandle('AmiBroker') ; Get AmiBroker window handle
If IsHWnd($g_hWnd) = 1 Then ; Check the window handle is valid
    If WinActive($g_hWnd) = 0 Then ; Check if AmiBroker is NOT active
        WinActivate($g_hWnd) ; If it's NOT active, activate it
        WinWaitActive($g_hWnd, '', 5) ; Wait for the handle to become active
    EndIf
    While 1 ; Loop forever
        $g_hListView = ControlGetHandle($g_hWnd, '', '[CLASS:SysListView32; INSTANCE:5]') ; Get the ListView handle
        $g_iCount = (_GUICtrlListView_GetItemCount($g_hListView) - 1) ; Get the number of items in the ListView
        $g_iIndex = 0
        Do
            _GUICtrlListView_EnsureVisible($g_hListView, $g_iIndex) ; Scrolls the ListView to the given index - which we're increasing by one below
            _GUICtrlListView_ClickItem($g_hListView, $g_iIndex, 'Left', False, 2, 0) ; Double click the ListView Item
            $g_iIndex += 1
            Sleep(2000) ; Wait 2000ms (2 seconds)
        Until $g_iIndex > $g_iCount ; Loop until we've reached the end of the ListView
        _GUICtrlListView_EnsureVisible($g_hListView, 0) ; Once we've reached the end of the ListView above, move back to the top of the ListView
        Sleep(15000) ; Wait 15000ms (15 seconds) - once we've waited, the While loop will restart
    WEnd
EndIf

 

Link to comment
Share on other sites

Thanks. Its working fine when Amibroker is in front but when i open another window say chrome and Amibroker is in background then it scrolls but doesn't click the stock.  

Is it possible to click/select the charts/stock even when Amibroker is in background.

 

Link to comment
Share on other sites

7 minutes ago, LearningEW said:

Thanks. Its working fine when Amibroker is in front but when i open another window say chrome and Amibroker is in background then it scrolls but doesn't click the stock.  

Is it possible to click/select the charts/stock even when Amibroker is in background.

 

Not that I'm aware of. Someone else may be able to help with that though.

Link to comment
Share on other sites

Luke,

One query....this script is using mouse click function to select the stock. Can this also be done by using arrow key function, as next stock can be selected by arrow keys also. Asking as this might then work in background.

 

 

Link to comment
Share on other sites

#include <GuiListView.au3>

Global $g_hWnd
Global $g_hListView
Global $g_iCount
Global $g_iIndex

$g_hWnd = WinGetHandle('AmiBroker') ; Get AmiBroker window handle
If IsHWnd($g_hWnd) = 1 Then ; Check the window handle is valid
    If WinActive($g_hWnd) = 0 Then ; Check if AmiBroker is NOT active
        WinActivate($g_hWnd) ; If it's NOT active, activate it
        WinWaitActive($g_hWnd, '', 5) ; Wait for the handle to become active
    EndIf
    While 1 ; Loop forever
        $g_hListView = ControlGetHandle($g_hWnd, '', '[CLASS:SysListView32; INSTANCE:5]') ; Get the ListView handle
        $g_iCount = (_GUICtrlListView_GetItemCount($g_hListView) - 1) ; Get the number of items in the ListView
        $g_iIndex = 0
        Do
            _GUICtrlListView_EnsureVisible($g_hListView, $g_iIndex) ; Scrolls the ListView to the given index - which we're increasing by one below
            ; _GUICtrlListView_ClickItem($g_hListView, $g_iIndex, 'Left', False, 2, 0) ; Double click the ListView Item
            _GUICtrlListView_SetItemSelected($g_hListView, $g_iIndex)
            $g_iIndex += 1
            Sleep(2000) ; Wait 2000ms (2 seconds)
        Until $g_iIndex > $g_iCount ; Loop until we've reached the end of the ListView
        _GUICtrlListView_EnsureVisible($g_hListView, 0) ; Once we've reached the end of the ListView above, move back to the top of the ListView
        Sleep(15000) ; Wait 15000ms (15 seconds) - once we've waited, the While loop will restart
    WEnd
EndIf

See if this works in the background first.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...