Seems like it would only be for AB to know if the
file has been changed. fileischanged is not written to the textfile that I
can see.
----- Original Message -----
Sent: Wednesday, September 12, 2007 12:58
AM
Subject: [amibroker] generating orders
from amibroker to a text file
hello,
Below is code snippet from the files section of
AT . basically Amibroker creates a text file and ninjatrader picksup the files
and places orders. question is, how is the
"fileischanged" being used here ?. I see that after a change its value is
set to 1. Is this just to let ninjatrader know that file has changed. I dont
know why this vaiable is used here?.
any thoughts?. thanks,Padhu
//////////////////// NINJATRADER OIF INTEGRATION
/////////// Ninja Trader Automation - START
///////////////
fileischanged = 0;
if (LastValue(Buy) == 1 AND AutomationSwitch ==1) {
mvOrderOIF =
"ES" +
"," + ContractsOrShareSize +
"," + TimeInForces +
"," + WriteIf(Buy,Action1,Action3) +
"," + ORdertypes +
"," + WriteVal(Limitprice ,1.2) +
"," +
"," +
"," +
"," +
"," +
"," + Simulatortypes +
"," + strategyname + ",";
Uniquefilename= WriteVal(DateTime(),formatDateTime)+"
"+Name();
mvOrderOIFLog =
Name () +
"," + ContractsOrShareSize +
"," + TimeInForces +
"," + WriteIf(Buy,Action1,Action3) +
"," + ORdertypes +
"," + WriteVal(Limitprice ,1.2) +
"," +
"," +
"," +
"," +
"," +
"," + Simulatortypes +
"," + strategyname + "," + Date() +","+WriteVal(Close ,1.4) +"\n";
Uniquefilename= WriteVal(DateTime(),formatDateTime)+"
"+Name();
filepath= "My Documents\NinjaTrader
6\incoming\oif.txt";
filehandle= fopen(filepath, "w");
fputs(mvOrderOIF,
filehandle);
fclose(filehandle);
filepath= "My Documents\NinjaTrader
6\LOG\ORDERLOG.txt";
filehandle= fopen(filepath, "a");
fputs(mvOrderOIFLog,
filehandle);
fclose(filehandle);
fileischanged= 1;
};
/////////////////// Sell Automation
fileischanged = 0;
if (LastValue(Sell) == 1 AND AutomationSwitch ==1) {
mvOrderOIF =
"ES" +
"," + ContractsOrShareSize +
"," + TimeInForces +
"," + WriteIf(Sell,Action2,Action3) +
"," + ORdertypes +
"," + WriteVal(Limitprice ,1.2) +
"," +
"," +
"," +
"," +
"," +
"," + Simulatortypes +
"," + strategyname + ",";
mvOrderOIFLog =
Name () +
"," + ContractsOrShareSize +
"," + TimeInForces +
"," + WriteIf(Sell,Action2,Action3) +
"," + ORdertypes +
"," + WriteVal(Limitprice ,1.2) +
"," +
"," +
"," +
"," +
"," +
"," + Simulatortypes +
"," + strategyname + "," + Date() +","+WriteVal(Close ,1.4) +"\n";
filepath= "C:\\Program
Files\\NinjaTrader\\NinjaTrader Version 3\\AT\\order.txt";
filehandle= fopen(filepath, "w");
fputs(mvOrderOIF,
filehandle);
fclose(filehandle);
filepath= "C:\\Program
Files\\NinjaTrader\\NinjaTrader Version
3\\DATA\\ATorderlog.txt";
filehandle= fopen(filepath, "a");
fputs(mvOrderOIFLog,
filehandle);
fclose(filehandle);
fileischanged= 1;
};
///////////// NinjaTrader integration code - end
//////////
__._,_.___
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
__,_._,___
|