Code: Select all
inputs:
BollingerPrice( Open ),
Length( 20 ),
NumDevsDn( -2 ),
NumDevsUp( 2 ),
Profit ( 0.19 ),
Distance (0.02),
Start ( 1200 ),
Ende ( 1800 );
[IntrabarOrderGeneration = true];
variables:
var0 ( 0 ) , var1 ( 0 ) , TPl ( 0 ) ,LE ( 0 ) , SE ( 0 ) ,
TPs ( 0 ) ;
var0 = BollingerBand( BollingerPrice, Length, NumDevsDn ) ;
var1 = BollingerBand( BollingerPrice, Length, NumDevsUp) ;
TPl = EntryPrice ( 0 ) + Profit ;
TPs = EntryPrice ( 0 ) - Profit ;
condition1 = CurrentBar > 1 and (marketposition = 0 )
and Time > Start and Time < Ende ;
condition3 = Close [1] < var1[1] and Close[1] > var0[1];
if condition1 and condition3 then
begin
LE = var1[0] + Distance ;
SE = var0[0] - Distance ;
Buy ( "BreakLE" ) next bar at LE stop;
Sell short ("BreakSE" ) next bar at SE stop;
end ;
if (marketposition = 1 ) then
begin
Sell ( "Break_L+" ) next bar at TPl limit ;
Sell ( "Break_L-" ) next bar at var0[0] stop ;
end;
if (marketposition = -1 ) then
begin
buytocover ( "Break_S+" ) next bar at TPs limit ;
buytocover ( "Break_S-" ) next bar at var1[0] stop ;
end;
I am using a 5-Minute-timeframe.
If the condition is true the limitorders for entry will be sent to IB correct.
After getting a new bar I get the message "Order is not filled within the specified bar" and both limitorders were deleted.
While condition was still true,there were no new limitorders sent to IB within this new bar.
With the next new bar I got 2 new orders and the same game began.
So I am for 5 minutes with limit in the market,then for 5 minutes not,then again in .....
If one limit order got filled I got the TP and SL-Limits.With the next new bar I got the message again and the orders were deleted.But in this case immediately there were sent 2 new Limits to IB.
Is there a method that the entry-limits get renewed immediately after the deletion of the former orders?