DAS Trader Pro Advanced Hotkeys part 43
A step by step guide for extended hours stops.
Why I do this special post
Many of you are writing me about specific errors you get on your implementation attempts and many readers expect my articles to be a solution they can just copy and paste. This is my first attempt to provide such content. It takes so much more testing and troubleshooting, so I am providing it to founding members only for now but do not worry, you can get it working for free as well.
Please watch the video of the functionality so that you know that this is what you need before you do the commitment to pay.
It consists of all the info I have already posted before so you can achieve the same by picking the techniques from the posts I already published before.
I am also providing all the code before the paywall so if you are my reader you can just take the files and build it up for free.
Once you do the commitment of becoming the founding member I will do my best to help you to implement it so that you get the same functionality as on the video. You will also get the access to the future step by step articles.
Foreword
The solution on the videos
works in extended hours or regular hours. (pre-market, market hours and post-market)
works with multiple positions opened at the same time
it does multiple retries of exit (configurable retries count) which is useful against missed fills. It tries to exit the position X times until really exited.
single button solution for both long or short stops based on the direction where you click and what kind of position you have opened.
does not interfere with anything you are using up today so you can slowly try to adapt to use this method
graphical indication of the enabled/disabled stop on the very same button
consists of 10 scripts shown below
works with 5.8.0.9 version
uses Alerts for visibility and manageability
has been tested with Ocean One Securities broker, other brokers customization needs will be indicated in the code and description
The scripts are marked with
- B_ as buttons
- H_ as hotkeys
- S_ as scripts
B_Account Switcher
//set your account names here
$SIMACCOUNT="TRXXXXX";
$REALACCOUNT="XXXXX";
if ($MYACCOUNT=="0")
{
$MYACCOUNT=$SIMACCOUNT;
$montage.GetCustButObj("AccSwitcher").text =SIM;
$montage.GetCustButObj("AccSwitcher").bkcolor=red;
$MONTAGE.ACCOUNT=($MYACCOUNT);
}
else
{
if ($MYACCOUNT==$SIMACCOUNT)
{
$MYACCOUNT=$REALACCOUNT;
$MONTAGE.ACCOUNT=$MYACCOUNT;
$montage.GetCustButObj("AccSwitcher").text =REAL;
$montage.GetCustButObj("AccSwitcher").bkcolor=green;
}
else
{
$MYACCOUNT=$SIMACCOUNT;
$MONTAGE.ACCOUNT=$MYACCOUNT;
$montage.GetCustButObj("AccSwitcher").text =SIM;
$montage.GetCustButObj("AccSwitcher").bkcolor=red;
}
}
B_AlertStop
$MONTAGE.exechotkey("ALRTDELALL");
CXL ALLSYMB;
$CLICKEDSTOP=Price;
setvar("MYSTOP_"+$MONTAGE.SYMBOL,$MONTAGE.PRICE);
$MYALERT=NewAlertObj();
$MYALERT.name="Clickedstop "+SYMB;
if($MYPOS>0)
{
$MYALERT.AddItem("Last Sale","<",$CLICKEDSTOP);
}
if($MYPOS<0)
{
$MYALERT.AddItem("Last Sale",">",$CLICKEDSTOP);
}
$MYALERT.Script="$montage.symbol="+$MYSYMB+";$wannagetout=1;";
$MYALERT.Speak=0;
$MYALERT.SYMB=$MYSYMB;
$MYALERT.PlaySound=0;
$MYALERT.Autodelete=1;
$MYALERT.Loop=0;
$MYALERT.PopupWindow=1;
$MYALERT.save();
$ALERTEXISTS=GetAlertObj("Clickedstop "+SYMB);
if (IsObj($ALERTEXISTS)==1)
{
$montage.GetCustButObj("B_clickedstop").text="Alert STOP Enabled";
$montage.GetCustButObj("B_clickedstop").bkcolor="green";
}
else
{
$montage.GetCustButObj("B_clickedstop").text ="Alert STOP Disabled";
$montage.GetCustButObj("B_clickedstop").bkcolor="red";
}
B_AlertStop_Disable
$montage.exechotkey("alrtdelall");
H_alrtdellall
$loop=10;
while ($loop>0)
{
$TODELALERT=GetAlertObj("Clickedstop "+SYMB);
if (IsObj($TODELALERT))
{
$TODELALERT.delete();
}
$loop=$loop-1;
}
$MY1MINWINDOW.RemoveALLLines;
H_DrawStopline
if ($MONTAGE.POS>0)
{
$drawstopline=$my1minchart.gettrendline("drawstopline_"+$MONTAGE.SYMBOL);
if (isobj($drawstopline)==1)
{
$drawstopline.delete();
}
$drawstopline=$my1minchart.CreateTrendline("horizline");
$drawstopline.name="drawstopline_"+$MONTAGE.SYMBOL;
$drawstopline.price=getvar("MYSTOP_"+$MONTAGE.SYMBOL);
$drawstopline.Visible=1;
$drawstopline.color="255,255,0";
$drawstopline.labelbgcolor="255,0,255";
$drawstopline.SendToGlobal();
$drawstopline.save();
}
else
{
$drawstopline=$my1minchart.gettrendline("drawstopline_"+$MONTAGE.SYMBOL);
if (isobj($drawstopline)==1)
{
$drawstopline.delete();
}
}
H_GetOut
$MYPOS=GetAccountObj($MYACCOUNT).getposition($MYSYMB).share;
if ($MYPOS==0)
{
MsgBox("No position to close");
}
else
{
$MONTAGE.CXL ALLSYMB;
if ($MYPOS>0)
{
$Montage.price=$montage.last*0.91;
}
else
{
$Montage.price=$montage.last*1.09;
}
if ($MONTAGE.Last>1)
{
$MONTAGE.Price=Round($Montage.price,2);
}
else
{
$MONTAGE.Price=Round($Montage.price,4);
}
//set your exit route
$MONTAGE.ROUTE="LIMIT";
$MONTAGE.Share=$MONTAGE.POS;
$MONTAGE.Send=Reverse;
}
edit the route according to your broker needs or preference
H_GetOutCheck
if ($wannagetout==1)
{
delvar("try");
while ($try<6)
{
if ($MONTAGE.POS>0)
{
$MONTAGE.EXECHOTKEY("GetOut");
wait(2000);
}
else
{
$wannagetout=0;
return;
}
$try=$try+1;
}
}
S_chart update
$MY1MINWINDOW=GetWindowObj("MY1MIN");
$MY1MINCHART=GetWindowObj("MY1MIN");
$MYSYMB=$MY1MINWINDOW.SYMBOL;
$MONTAGE=GetWindowObj("MONTAGE1");
$LASTPRICE=$MONTAGE.LAST;
$MYPOS=GetAccountObj($MYACCOUNT).getposition($MYSYMB).share;
//alert button color
$ALERTEXISTS=GetAlertObj("Clickedstop "+SYMB);
if (IsObj($ALERTEXISTS)==1)
{
$montage.GetCustButObj("B_clickedstop").text="Alert STOP Enabled";
$montage.GetCustButObj("B_clickedstop").bkcolor="green";
}
else
{
$montage.GetCustButObj("B_clickedstop").text ="Alert STOP Disabled";
$montage.GetCustButObj("B_clickedstop").bkcolor="red";
delvar("MYSTOP_"+$MONTAGE.SYMBOL);
}
//
//auto position exit if getout triggered
$montage.exechotkey("getoutcheck");
S_Desktop Load
$MYACCOUNT="YOUR PREFERED DEFAULT ACCOUNT";
S_Timer Event
$montage.exechotkey("drawstopline");
Go step by step, do not skip any step. Consult any issues encountered.
Preparations
Install DAS Trader Pro version 5.8.0.9 or newer.
Enable double click to trade on your chart