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 //////////