PureBytes Links
Trading Reference Links
|
Thanks for your help!!
i also posted on another board and got a similar reply. you can see
below:
http://www.elitetrader.com/vb/showthread.php?
s=&threadid=101655&perpage=6&pagenumber=2
but it seems i cannot simply insert the cancel-code into the rest of
the program to make it work, still lack cancel codes.
//SETTING
A1 = 50;
B1 = 50;
C1 = 50;
D1 = 50;
//param trigger button to reset status
resetStatus = ParamTrigger("resetStatus","resetStatus");
//START
DateNumNow = Now(3);
DN = DateNum();
TN = TimeNum();
//check if order placed
OrderPlaced = StaticVarGet("OrderPlaced");
if(resetStatus)
{
StaticVarSet("OrderPlaced",0);
}
OrderPlaced = StaticVarGet("OrderPlaced");
//check if order is triggered, place order if condition fullfiled
if( (IsEmpty(OrderPlaced) OR OrderPlaced==0) )
{
ibc = GetTradingInterface("IB");
IBcStatus = ibc.IsConnected();
if( IBcStatus )
{
//Long side, place order
StaticVarSet("OrderPlaced",1);
LimitBuy = D1+A1;
parentIDLong = ibc.PlaceOrder(Name(), "BUY", 1, "LMT", LimitBuy,
0, "DAY", False );
ibc.PlaceOrder(Name(), "SELL", 1, "LMT", LimitBuy+B1, 0, "DAY",
False, 1, "", parentIDLong );
ibc.PlaceOrder(Name(), "SELL", 1, "TRAIL", C1, C1, "DAY", True,
1, "", parentIDLong );
//short side, place order
LimitSell = D1+B1;
parentIDShort = ibc.PlaceOrder(Name(), "SELL", 1, "LMT", LimitSell,
0, "DAY", False );
ibc.PlaceOrder(Name(), "BUY", 1, "LMT", LimitSell-D1, 0, "DAY",
False, 1, "", parentIDShort );
ibc.PlaceOrder(Name(), "BUY", 1, "TRAIL", C1, C1, "DAY", True, 1, "",
parentIDShort );
}
}
> you need a flag
>
> if((last-price) == (A + B)) condition1 = true;
> if(condition1 AND (last-price) == (A + C)) Cancel Order;
>
> BR
>
--- In amibroker@xxxxxxxxxxxxxxx, "eric tao" <erichtao@xxx> wrote:
>
> also, you might need to put the condition flag in static variable
like
> this
>
>
> if( ) staticvarset("condition1" + name(), true);
> ...
>
> BR.
>
> --- In amibroker@xxxxxxxxxxxxxxx, "lesslimbs" <lesslimbs@> wrote:
> >
> > hi , i like to write a order-cancelling action with two chained
> > conditions but dont know how.
> >
> > it's like this:
> > given : A, B, C
> >
> > conidtion 1:
> > IF last-price = A+ B, trigger condition 2
> > condition 2:
> > when last-price = A+C , Cancel buy or sell order
> >
> > in the above, condition1 must precede condition2 (OR without
> > condition1, condition2 will not be triggerred)
> >
> >
> > i'm using TWS platform.
> >
> > thanks!
> >
>
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
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/amibroker/
<*> Your email settings:
Individual Email | Traditional
<*> To change settings online go to:
http://groups.yahoo.com/group/amibroker/join
(Yahoo! ID required)
<*> To change settings via email:
mailto:amibroker-digest@xxxxxxxxxxxxxxx
mailto:amibroker-fullfeatured@xxxxxxxxxxxxxxx
<*> 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/
|