Hi,
I have about 10 strategies running against a
watchlist of 18 symbols. When AA runs the scan,
a) Does it run the entire code going through each
strategy for one symbol followed by next symbol?
or
b) Does it go through each buy/sell rule per
symbol, then scan again with second buy/sell rule for next symbol?.
The reason I am asking is I am looking to move the
order files from amibroker to Metatrader4's folder where the API interface will
pick up the orders.
So I am looking for the right place to set some
variable that will indicate all AFL code is executed in AA and now its ok to
move the order files.
Right now I am using timenum to check for the 3rd
minute to start, before it moves the files to allow to complete its scan. But
sometimes the AA may be done in 1min, in which I will be idling for 2mins before
orders
are moved.
buyrule1=..............;
buyrule2=.......;
buyrule3=..............;
buyrule4=.......;
buyrule5=..............;
buyrule6=.......;
if lastvalue(buy1)
{
create orderfiles
}
if lastvalue(buy6)
{
create orderfiles
ALL_STRATEGIES_SCAN_COMPLETED=1;
///vARIABLE SET AT THE LAST RULE..Is this a good approach?
}
IF
LASTVALUE(ALL_STRATEGIES_SCAN_COMPLETED)
{
RUN BELOW _vbscript_ TO MOVE ORDER FILES
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
EnableScript ("_vbscript_");
<%
function movefiles(source,destination)
dim result, fso2
Set fso2 = CreateObject("Scripting.FileSystemObject")
Set objfilemove = fso2.GetFile(source)
result=objfilemove.Move (destination)
movefiles=result
end function
%>
script= GetScriptObject();
sourcefile1= "C:\\Program
Files\\Amibroker\\AFL\\PADHU\\AT\\order1.txt";
destfile1= "C:\\Program
Files\\Amibroker\\AFL\\PADHU\\AT\\MT4\\mt4_orders1.txt";
sourcefile2= "C:\\Program
Files\\Amibroker\\AFL\\PADHU\\AT\\order2.txt";
destfile2= "C:\\Program
Files\\Amibroker\\AFL\\PADHU\\AT\\MT4\\mt4_orders_2.txt";
sourcefile3= "C:\\Program
Files\\Amibroker\\AFL\\PADHU\\AT\\order3.txt";
destfile3= "C:\\Program
Files\\Amibroker\\AFL\\PADHU\\AT\\MT4\\mt4_orders_3.txt";
Current_Timenum= TimeNum();
Previous_Timenum= Ref(TimeNum(),-1);
Newbar_Difference=Current_Timenum-Previous_Timenum;
Newbar_Difference_300=(Newbar_Difference == 300);
"Newbar_Difference_300 is " +Newbar_Difference_300;
NewBar_Started_2minsago= IIf(Newbar_Difference_300,1,0);
"NewBar_Started_2minsago " +NewBar_Started_2minsago;
"LastValue_NewBar_Started_2minsago_" +LastValue(NewBar_Started_2minsago);
//Write files at begining of
3rdminute
if ( LastValue(NewBar_Started_2minsago)
)
{
movemt4files1=script.movefiles(sourcefile1, destfile1);
movemt4files2=script.movefiles(sourcefile2, destfile2);
movemt4files3=script.movefiles(sourcefile3, destfile3);
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
__._,_.___
Please note that this group is for discussion between users only.
To get support from AmiBroker please send an e-mail directly to
SUPPORT {at} amibroker.com
For NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
http://www.amibroker.com/devlog/
For other support material please check also:
http://www.amibroker.com/support.html
__,_._,___
|