In the last tutorial, we learn how to automate the algomojo login process and in this video tutorial, we are going to learn with a click of an Amibroker button how one can automatically log in to the Algomojo trading platform.
How to Setup Automated Login from Algomojo?
1)Download the Automated Login Files for Algomojo
2)Unzip the files to your local machine and copy the files Algomojo AutoLogin.exe, chromedriver.exe, config.yaml &Readme.txt files and move to your Amibroker Installation Path,
3)Open config.yaml and configure the Login Credentials and 2 FA credentials as per the Readme.txt file format.
4)Copy the below Amibroker AFL Files and Save the File as Algomojo AutoButtonLogin.afl
//////////////////////////////////////////////
//Multi Broker Algomojo Login Module
//Coded by Algomojo
//Date : 18/01/2021
//////////////////////////////////////////////
_SECTION_BEGIN("Algomojo Auto Login");
X0 = 20;
Y0 = 100;
X1 = 100;
LBClick = GetCursorMouseButtons() == 9; // Click
MouseX = Nz(GetCursorXPosition(1)); //
MouseY = Nz(GetCursorYPosition(1)); //
procedure DrawButton (Text, x1, y1, x2, y2, colorFrom, colorTo)
{
GfxSetOverlayMode(0);
GfxSelectFont("Verdana", 9, 700);
GfxSetBkMode(1);
GfxGradientRect(x1, y1, x2, y2, colorFrom, colorTo);
GfxDrawText(Text, x1, y1, x2, y2, 32|1|4|16);
}
GfxSetTextColor(colorWhite);
DrawButton("Broker Login", X0, Y0, X0+X1, Y0+30, colorGreen, colorGreen);
CursorInBuyButton = MouseX >= X0 AND MouseX <= X0+X1 AND MouseY >= Y0 AND MouseY <= Y0+30;
LoginButtonClick = CursorInBuyButton AND LBClick;
DrawButton("Reset Login", X0, Y0+40, X0+X1, Y0+70, colorRed, colorRed);
CursorInSellButton = MouseX >= X0 AND MouseX <= X0+X1 AND MouseY >= Y0+40 AND MouseY <= Y0+70;
ResetButtonClick = CursorInSellButton AND LBClick;
if(StaticVarGet(Name()+GetChartID()+"Initialize")==0)
{
StaticVarSet(Name()+GetChartID()+"AutoLogin",0);
StaticVarSet(Name()+GetChartID()+"ResetLogin",0);
StaticVarSet(Name()+GetChartID()+"Initialize",1);
}
else
{
StaticVarSet(Name()+GetChartID()+"Initialize",0);
}
if( LoginButtonClick AND StaticVarGet(Name()+GetChartID()+"AutoLogin")==0 )
{
_TRACE("Login Button clicked");
ShellExecute("C:\\Program Files (x86)\\AmiBroker\\Algomojo AutoLogin.exe", "", "" ,1);
StaticVarSet(Name()+GetChartID()+"AutoLogin",1);
Say("Broker Login Clicked");
StaticVarSet(Name()+GetChartID()+"ResetLogin",0);
}
if( ResetButtonClick AND StaticVarGet(Name()+GetChartID()+"ResetLogin")==0 )
{
_TRACE("Reset Button clicked");
StaticVarSet(Name()+GetChartID()+"AutoLogin",0);
StaticVarSet(Name()+GetChartID()+"ResetLogin",1);
Say("Reset Login Clicked");
}
if(StaticVarGet(Name()+GetChartID()+"AutoLogin")==1)
{
DrawButton("Broker Login", X0, Y0, X0+X1, Y0+30, colorGrey40, colorGrey40);
}
if(StaticVarGet(Name()+GetChartID()+"ResetLogin")==1)
{
DrawButton("Reset Login", X0, Y0+40, X0+X1, Y0+70, colorGrey40, colorGrey40);
}
_SECTION_END();
_SECTION_BEGIN("Price");
SetChartOptions(0,chartShowArrows|chartShowDates);
_N(Title = "");
Plot( C, "Close", ParamColor("Color", colorDefault ), styleNoTitle | ParamStyle("Style") | GetPriceStyle() );
_SECTION_END();
5)Open a New Blank Charts and Drag and Drop the AFL Code
6)Now Press the Broker Login button to Make your Login Automatically. If in case you want to change the broker then re-configure the config.yaml file accordingly
7)Use the Reset Button if in case you need to Relogin