I have this code
Code: Select all
Sell("Exit L200-CS200 Target") 100 Shares Next Bar at (EntryPrice + t2) Limit;
Code: Select all
Sell("Exit L200-CS200 Target") 100 Shares Next Bar at (EntryPrice + t2) Limit;
look upHi,
I have this code
but i dont want to have to wait until the next bar to execute the sale, if it hits the target on the current bar, i would like to sell it then.. how do I change the code properly?Code: Select all
Sell("Exit L200-CS200 Target") 100 Shares Next Bar at (EntryPrice + t2) Limit;
Code: Select all
if MarketPosition = 0 and time>1000 and (time <1600) then begin
If Low > Low[1] and High > High[1] then begin
if barstatus(1) = 2 then Buy ("Enter Long") 300 Shares Next Bar At (High+buypoint) stop;
end;
....
....
....
if CurrentShares = 100 then begin
Sell("Exit L300-CS100 Target") 100 Shares next Bar at (EntryPrice + t3) Limit;
Sell("Exit L300-CS100 Stop") 100 Shares next Bar at st3 Stop;
end;
You are on the right track...ok thanks the information, but i still have an issue to make it work.
When I enter I want the next bar, but when exiting it can be the current bar (since current bar is the bar where I entered.
Here is some example code, I tried to use barstatus...
Code: Select all
if MarketPosition = 0 and time>1000 and (time <1600) then begin
If Low > Low[1] and High > High[1] then begin
if barstatus(1) = 2 then Buy ("Enter Long") 300 Shares Next Bar At (High+buypoint) stop;
end;
....
....
....
if CurrentShares = 100 then begin
Sell("Exit L300-CS100 Target") 100 Shares next Bar at (EntryPrice + t3) Limit;
Sell("Exit L300-CS100 Stop") 100 Shares next Bar at st3 Stop;
end;
Code: Select all
[intrabarordergeneration = true]
If Low > Low[1] and High > High[1] then begin
if barstatus(1) = 2 then Buy ("Enter Long") 300 Shares Next Bar At (High) stop;
end;
....
....
....
if CurrentShares = 100 then begin
Sell("Exit L300-CS100 Target") 100 Shares next Bar at (EntryPrice) Limit;
Sell("Exit L300-CS100 Stop") 100 Shares next Bar at st3 Stop;
end;
Code: Select all
[IntrabarOrderGeneration = true]
if MarketPosition = 0 and barstatus(1) = 2 and Low > Low[1] and High > High[1] then begin
Print("This is the closing tick of the bar.");
print ("this is buyTrigger = "+ NumToStr(buyTrigger ,0));
print ("timea = " + NumToStr(Time,0));
Buy ("Enter Long") 300 Shares Next Bar At high stop;
end;
// manage open orders
if MarketPosition = 1 then begin
st1 = EntryPrice - (stopsize * TickSize);
st2 = iff(BE2 = 1, EntryPrice, EntryPrice-(stopsize * TickSize));
st3 = iff(BE3 = 1, EntryPrice, EntryPrice-(stopsize * TickSize));
print ("this is ticksize = "+ NumToStr(ticksize ,2));
print ("this is enter = "+ NumToStr(entryprice ,2));
print ("this is stop = "+ NumToStr(st1 ,2));
print ("this is stopsize = "+ NumToStr(stopsize ,2));
if CurrentShares = 100 then begin
Sell("Exit L300-CS100 Target") 100 Shares next Bar at (EntryPrice + t3) Limit;
Sell("Exit L300-CS100 Stop") 100 Shares next Bar at st3 Stop;
end;
if CurrentShares = 200 then begin
Sell("Exit L200-CS200 Target") 100 Shares Next Bar at (EntryPrice + t2) Limit;
Sell("Exit L200-CS200 Stop") 100 Shares Next Bar at st2 Stop;
Sell("Exit L300-CS200 Target") 100 Shares Next Bar at (EntryPrice + t3) Limit;
Sell("Exit L300-CS200 Stop") 100 Shares Next Bar at st3 Stop;
end;
if CurrentShares = 300 then begin
Sell("Exit L100-CS300 Target") 100 Shares Next Bar at (EntryPrice + t1) Limit;
Sell("Exit L100-CS300 Stop") 100 Shares Next Bar at st1 Stop;
Sell("Exit L200-CS300 Target") 100 Shares Next Bar at (EntryPrice + t2) Limit;
Sell("Exit L200-CS300 Stop") 100 Shares Next Bar at st2 Stop;
Sell("Exit L300-CS300 Target") 100 Shares Next Bar at (EntryPrice + t3) Limit;
Sell("Exit L300-CS300 Stop") 100 Shares Next Bar at st3 Stop;
end;
end;
Code: Select all
inputs:
target1 (10),
target2(20),
target3(30),
stopsize(200),
buyCushion (.20),
BE2(0) , // 0=false, 1 = true
BE3(0); // 0=false, 1 = true
vars:
TickSize (MinMove/PriceScale),
smav (0),
emav (0),
hmav(0),
t1 (target1*TickSize),
t2 (target2*TickSize),
t3 (target3*TickSize),
st1 (0),
st2 (0),
st3 (0),
buyTrigger(0);
Unfortunately there is no way this box can be checked by default when IOG is on.Found the solution i have to check "Allow unlimited entries and exits per bar"
is there a way to make this default? or a command I can put in the script to make it checked?
Thanks in advance
Code: Select all
[IntrabarOrderGeneration=true]
[IntrabarOrderGenerationMode=1]