[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: [amibroker] creating a basket order file



PureBytes Links

Trading Reference Links

do you have a system you've tested and trying to trade? If not then maybe
you need to concentrate on that before you spend a lot of time on this part.
If you do then I can probably give you some guidance/pointers/whatever.
 
d


  _____  

From: ed nl [mailto:ed2000nl@xxxxxxx] 
Sent: Friday, September 10, 2004 11:19 AM
To: amibroker@xxxxxxxxxxxxxxx
Subject: Re: [amibroker] creating a basket order file


hi,

I am still working on the making of a file that contains order lines for
Interactive Brokers "basket" trading. I have been playing with a test system
in AFL (see result below). But the problem still is that I want to know
exactly what to sell and how many. Also I have problems starting a "fresh"
file for each new backtest. But I am afraid that with only using AFL it is
not possible to make this file.

I guess the solution is to use scripting and create data objects and derive
the info from them. In the archives there is some stuff I found and maybe if
I plough real deep something will surface ..... but could somebody direct me
how to best learn to use this scripting. There is some in the manual but if
there is some other place to learn this please let me know (especially about
which objects and methods that can be used).

rgds, Ed





function
order_func(Buy,Sell,Short,Cover,buyLimit,shortLimit,stop_long,stop_Short) {


filepath = "C:\\IBorders\\order.txt";

orderLine = 
WriteIf(LastValue(Buy) != 0,"BUY", 
WriteIf(LastValue(Short) != 0,"SHORT", 
WriteIf(LastValue(Sell) != 0,"SELL", 
WriteIf(LastValue(Cover) != 0,"COVER","")))) 
+
", "
+
Name()
+
", "
+
"STK"
+
", "
+
"SMART"
+
", "
+
"LMT"
+
", "
+
WriteIf(LastValue(Buy) != 0,NumToStr( LastValue(buyLimit), format = 1.2), 
WriteIf(LastValue(Short) != 0,NumToStr( LastValue(shortLimit), format =
1.2), 
WriteIf(LastValue(Sell) != 0,NumToStr( LastValue(stop_long), format = 1.2), 
WriteIf(LastValue(Cover) != 0,NumToStr( LastValue(stop_short), format =
1.2),"")))) 
+"\n";

fileischanged = 0;

if (LastValue(Buy) != 0 OR LastValue(Short) != 0 OR LastValue(Sell) != 0 OR
LastValue(Cover) != 0) {

if (fileischanged = 0) {

  filehandle = fopen(filepath, "w");
  fputs(orderLine, filehandle);
         fclose(filehandle);
         fileischanged=1;
         
        } else if (fileischanged = 1) {
        
    filehandle = fopen(filepath, "a");
  fputs(orderLine, filehandle);
         fclose(filehandle);
        }
        
} 


}


//fdelete("C:\\IBorders\\order.txt");

SetOption("MaxOpenPositions", 50 ); 
PositionSize = -15;
SetTradeDelays(0,0,0,0);

sk = StochK(8);
Buy = sk < 30;
BuyPrice = O;

Short = sk > 70;
ShortPrice = O;

Sell = 0;
Cover = 0;

ApplyStop( stopTypeNBar,stopModeBars,1,ExitAtStop = 1,Volatile = False,
ReentryDelay = 1 );

SellPrice = C;
CoverPrice = C;

Equity(1);

PositionScore = 50 - StochK(8); 

Filter = (PositionScore AND Buy);

order_func(Buy,Sell,Short,Cover,BuyPrice,ShortPrice,SellPrice,CoverPrice);

[Non-text portions of this message have been removed]



Check AmiBroker web page at:
http://www.amibroker.com/

Check group FAQ at:
http://groups.yahoo.com/group/amibroker/files/groupfaq.html 



Yahoo! Groups Sponsor	

ADVERTISEMENT
 
<http://us.ard.yahoo.com/SIG=1292h5rr5/M=295196.4901138.6071305.3001176/D=gr
oups/S=1705632198:HM/EXP=1094915973/A=2128215/R=0/SIG=10se96mf6/*http://comp
anion.yahoo.com> click here	
 
<http://us.adserver.yahoo.com/l?M=295196.4901138.6071305.3001176/D=groups/S=
:HM/A=2128215/rand=128831960> 	


  _____  

Yahoo! Groups Links


*	To visit your group on the web, go to:
http://groups.yahoo.com/group/amibroker/
  

*	To unsubscribe from this group, send an email to:
amibroker-unsubscribe@xxxxxxxxxxxxxxx
<mailto:amibroker-unsubscribe@xxxxxxxxxxxxxxx?subject=Unsubscribe> 
  

*	Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service
<http://docs.yahoo.com/info/terms/> . 




[Non-text portions of this message have been removed]



------------------------ Yahoo! Groups Sponsor --------------------~--> 
Make a clean sweep of pop-up ads. Yahoo! Companion Toolbar.
Now with Pop-Up Blocker. Get it for free!
http://us.click.yahoo.com/L5YrjA/eSIIAA/yQLSAA/GHeqlB/TM
--------------------------------------------------------------------~-> 

Check AmiBroker web page at:
http://www.amibroker.com/

Check group FAQ at: http://groups.yahoo.com/group/amibroker/files/groupfaq.html 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/amibroker/

<*> To unsubscribe from this group, send an email to:
    amibroker-unsubscribe@xxxxxxxxxxxxxxx

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/