Scenario:
Consider a case where you already have your Trading Strategy on Zerodha PI. This is written in TadeScript.
Normally this code can be re-written in any other platform. But there
is a catch - What if you are using some TradeScript specific built-in
function like TREND . As per the manual, the TREND function is built-in to the core of the programming language , "primitives" , as they call it.
Recreating the TREND
in a programming language like Python calls for reverse engineering.
And despite my efforts, I was not able to do so accurately. My take is
that identifying the trend of any financial instrument goes a long
way In determining the profitability of a trader. And the Trend function
in TradeScript is pretty good. So the best way forward is to retain
the strategy "as is" in TradeScript and merely Scarp the data from the
Scanner output of Zerodha.
I first tried to scarp the data using AutoIt
. But then the reality dawned upon me that AutoIt does not
support .NET based WinForms and Windows Presentation Forms (WPF).
This can be determined with the help of the Inspect tool provided in Windows 10SDK
. ( On Win10, the following path should help you to locate
Inspect.exe: C:\Program Files (x86)\Windows Kits\10\bin\10.0.15063.0\x86
). The UIA Verify can also be used and is installed with the Windows
Software Development Kit (SDK). It is located in the \bin\<platform>\UIAVerify folder of the SDK installation path (VisualUIAVerifyNative.exe).
Although AutoIt didn’t help, thankfully Pywinauto was up and ready with version 0.6.1 that fully supports MSUI Automation (UIA support for WinForms, WPF, Qt, browsers, Store apps and more).
A point to
note here is that once we identify the type of Controls of the Zerodha
Pi Scanner Output using Inspect / Spy ++ / UIAVerify / AutoIt Window
Info , put these tools to rest. For use in the Python program, use the
name of the specific dialog by using the Control Identifiers from print_control_identifiers() method of Pywinauto