In all the code I have imported from TS, the functions "setprofittarget" and "setstoploss" do not work. Any help would be greatly appreciated, below is the code causing the problem:
Inputs: PositionBasis(false), StopAmount(150), ProfitAmount(50);
If PositionBasis Then
SetStopPosition
Else
SetStopContract;
SetStopLoss(StopAmount);
SetProfitTarget(ProfitAmount);
setprofittarget and setstoploss not working [SOLVED]
Using setstoploss with IB
hi
Are stops generated by setstoploss sent to IB or keep on our pc ?
IF we do a SAR do we need to cancel the stop loss orders ?
thanks
Are stops generated by setstoploss sent to IB or keep on our pc ?
IF we do a SAR do we need to cancel the stop loss orders ?
thanks
- Marina Pashkova
- Posts: 2758
- Joined: 27 Jul 2007
Re: Using setstoploss with IB
They are sent to IB as any other stop orders.hi
Are stops generated by setstoploss sent to IB or keep on our pc ?
SAR and stop loss are mutually exclusive.IF we do a SAR do we need to cancel the stop loss orders ?
thanks
Re: Using setstoploss with IB
So say i perform the following sequenceThey are sent to IB as any other stop orders.hi
Are stops generated by setstoploss sent to IB or keep on our pc ?
SAR and stop loss are mutually exclusive.IF we do a SAR do we need to cancel the stop loss orders ?
thanks
1. Buy
2. setStopLoss ( a sell stop would be send to IB right ? )
3. SellShort
4. setStopLoss ( a buy stop would be send to IB right ? )
At which point is the sell StopLoss at 2 that was send to IB canceled ?
Is it canceled automatically when i do a SellShort at 3 ?
Or do i have to cancel it first ? if i have to cancel it first what is the syntax ?
thanks
- Marina Pashkova
- Posts: 2758
- Joined: 27 Jul 2007
[SOLVED]
Hi aljafp,
The information above is not enough to answer your question. Could you post an excerpt from the code? Or you could send it to my e-mail: mpashkova@tssupport.com
Thank you.
The information above is not enough to answer your question. Could you post an excerpt from the code? Or you could send it to my e-mail: mpashkova@tssupport.com
Thank you.
hi marina, have send you an email, but just in case you didn't get it,Hi aljafp,
The information above is not enough to answer your question. Could you post an excerpt from the code? Or you could send it to my e-mail: mpashkova@tssupport.com
Thank you.
here's the code:
variables: intrabarpersist currentBuyBar(0),
intrabarpersist currentSellBar(0);
if high>=highest(high,3)[1] and currentBuyBar<>currentBar then begin
Buy 1 shares next bar at market;
setstoploss(500);
currentBuyBar=currentBar;
end;
if low<=lowest(low,3)[1] and currentSellBar<>currentBar then begin
sellshort 1 shares next bar at market;
setstoploss(500) ;
currentSellBar=currentBar;
end
/*
Say the first condition is satisfied and i now have a long position with
a sell stoploss send to IB.
If the second condition is now satisfied, at which point is the first
sell stop loss cancelled ?
thanks
*/
- Marina Pashkova
- Posts: 2758
- Joined: 27 Jul 2007