Hello,
I am currently working on something like that. Basically Amibroker will
generate the csv order file and I have hired a programmer who is writing a csv
bridge to feed this order into metatrader for Forex.
But I am having issues with the file functions in AA Scan mode. I could see the
orders being sent to the text file when I use as indicator, however when I run
in AA mode, they are NOT writing to file.
Below is the code.
//// Export Trade Signals to an order and Log file...............
/////////////////// Buy Automation
fileischanged = 0;
if (LastValue(Cover) == 1 ) {
mvOrderOIF =
Broker_Symbol+
","+ "BUYSTOP" +
","+ 2 +
","+ (High+Entry_Offset_For_ScalperTrades) +
","+0+
","+ (Low-Stop_Offset_For_ScalperTrades) +
","+ (High+-EXIT_Offset_For_ScalperTrades) +
"," + "Scalper1_Buy" +
"," + "0";
mvOrderOIFLog =
Broker_Symbol+
","+ "BUYSTOP" +
","+ 2 + "Lots " +
","+ (High+Entry_Offset_For_ScalperTrades) +
","+0+
","+ (Low+Stop_Offset_For_ScalperTrades) +
","+ (High+-EXIT_Offset_For_ScalperTrades) +
"," + "Scalper1_Sell" +
"," + "0"
+ Date() +","+WriteVal(Close ,1.4) +"\n";
filepath="C:\\Program Files\\Amibroker\\AFL\\PADHU\\AT\\order.txt";
filehandle=fopen(filepath, "w");
fputs(mvOrderOIF, filehandle);
fclose(filehandle);
filepath="C:\\Program Files\\Amibroker\\AFL\\PADHU\\AT\\order_log.txt";
filehandle=fopen(filepath, "a");
fputs(mvOrderOIFLog, filehandle);
fclose(filehandle);
fileischanged=1;
};
/////////////////// Buy Automation
//pair, operation, lots, price, slippage, SL, TP, comment (or NULL), expiration
(or zero).
fileischanged = 0;
if (LastValue( Short) == 1 ) {
mvOrderOIF =
Broker_Symbol+
","+ "SELLSTOP" +
","+ 2 +
","+ (Low-Entry_Offset_For_ScalperTrades) +
","+0+
","+ (High+Stop_Offset_For_ScalperTrades) +
","+ (Low-EXIT_Offset_For_ScalperTrades) +
"," + "Scalper1_Sell" +
"," + "0";
mvOrderOIFLog =
Broker_Symbol+
","+ "SELLSTOP" +
","+ 2 + "Lots " +
","+ (Low-Entry_Offset_For_ScalperTrades) +
","+0+
","+ (High+Stop_Offset_For_ScalperTrades) +
","+ (Low-EXIT_Offset_For_ScalperTrades) +
"," + "Scalper1_Sell" +
"," + "0"
+ Date() +","+WriteVal(Close ,1.4) +"\n";
filepath="C:\\Program Files\\Amibroker\\AFL\\PADHU\\AT\\order.txt";
filehandle=fopen(filepath, "w");
fputs(mvOrderOIF, filehandle);
fclose(filehandle);
filepath="C:\\Program Files\\Amibroker\\AFL\\PADHU\\AT\\order_log.txt";
filehandle=fopen(filepath, "a");
fputs(mvOrderOIFLog, filehandle);
fclose(filehandle);
fileischanged=1;
};
==============================================
If anyone has any ideas why Amibroker won't write to file in AA Scan mode but
does in Indicator mode applied to chart?. Thanks.
Cheers,Padhu
----- Original Message -----
From: dingo
To: [EMAIL PROTECTED]
Sent: Wednesday, September 12, 2007 1:06 PM
Subject: [AmiBroker-at] Has anyone done an AT type system like this?
I'd like to see a "simple" AT system for EOD type trading where a file of
tickers, Action (buy, sell, Short, Cover, stop), position sizes in dollars,
etc. has been created by an AFL the prior evening and it is this programs
job to read in that file and then pass the appropriate info to IB.
If anyone has any code along these lines I'd sure like to see it if you're
willing to share.
d