Stoploss not put in place
Forums › ProRealTime English forum › ProOrder support › Stoploss not put in place
- This topic has 36 replies, 8 voices, and was last updated 11 months ago by ashehzi.
-
-
12/22/2023 at 9:25 AM #22560912/22/2023 at 9:56 AM #225610
ok guys, since it seems like nobody knows anything about that “set target ploss” command, I was testing it a bit live in order to understand how it works.
first was running this ultrasimple code:
set target ploss 50123456if not onmarket thenbuy 0.5 lot at marketendifset target pprofit 50set target ploss 50well, every time as soon as position was opened, immediately it was closed.
was reading manual again – and understood better: “set target ploss” places a “limit” order, when a position is loosing. so adjusted the code, placed that command with the condition that position is loosing:
1234567if not onmarket thenbuy 0.5 lot at marketendifif close < tradeprice thenset target ploss 5endifnow it kind of worked, probably in a way like it is supposed to work:
in case after bar closing latent loss was bigger than 5 points, system was placing a limit order with 5 points distance from tradeprice.
in case after bar closing latent loss was less than 5 points, position was closed immediately (that means: algo was “trying” in fact to place a limit order but because limit level was below current price order was “translated” into “at market” order).
well now at least for me it’s quity clear how “set target loss” is working, and it’s clear that this command must be not used as the only one command in order to limit losses, one should have addtionally something, like a standard order placed via “set stop loss” like this:
123456789if not onmarket thenbuy 0.5 lot at marketendifset stop ploss 50if close < tradeprice thenset target ploss 5endifI will come back with few more comments on then concept of “set target loss”….
12/22/2023 at 10:20 AM #225612The result of that call :
“Hmm … I don’t know; IG can deal with this differently than IB” (in IB the StopLoss’s are always visible in Trader Workstation).
But we could not spend much time because the person in question has a day off.I suppose it is offtopic for this thread (is it ?), but the result of that other investigation with the ridiculous distances required causing an order not too Enter (obtain position) was waved by IG with a “Yeah, well, we can’t tell why that is, because Limits are also subject to a minimum distance“. This was real news and even PRT in Paris is astounded by this.
Subjectively this was judged by ProRealTime as BS because it gave IG the opportunity to not give an answer at all.12/22/2023 at 11:18 AM #225614so these are my thoughts about the concept of “set target loss” command after seeing how it works.
basically I don’t see any benefit of this concept. it breeds hope – a hope that when position is losing more than X points those losses could be reduced to the exactly X points. and in this sense hope has no place in trading, playing around this way with the losses is not a business plan. yep, control over losses is the only one thing which a trader has (and not even that for 100%), and by having in the algo only “set target loss” for limiting the losses one gives away that control. it’s a highway to bankruptcy. before prices come back to the X they can go 100 times more in the opposite direction, there is no guarantee that they ever come back to the X.
well, even combination of “set target loss” with “set stop loss” gives from my perspective no benefit. when market goes against my trade, at certain point – at precisely defined level (or time) – I have to admit it and get out immediately, and that job is done either by “set stop loss” or sell at market / exitshort at market. when trade is “dead” it’s dead, next trade please… by inventing/adding “set target loss” one kind of hopes that trade which is almost dead (almost but not yet reaching stop loss level) is possibly only a bit “sick”.
ok, that is my thinking, maybe limited by my experiences, lack of knowledge and poor imagination 😀
I hope somebody will disagree
1 user thanked author for this post.
12/22/2023 at 12:11 PM #225615I suppose it is offtopic for this thread (is it ?), but the result of that other investigation with the ridiculous distances required causing an order not too Enter (obtain position) was waved by IG with a “Yeah, well, we can’t tell why that is, because Limits are also subject to a minimum distance“. This was real news and even PRT in Paris is astounded by this.
yep, this topic with minimum distances (for entries) is not exactly at the right place here, but since you touched it, I will add a bit. IG is acting here very intransparent. if what they are doing is legaly fine, they should tell openly what exactly they are doing, why they are doing it and maybe even announce in advance somehow from when to when which minimum distances will be in place for which instruments. this year I was contacting them several times regarding min dinstances and got various responses which basically were leading nowhere (I avoid to use more harsh expressions…):
– some persons at IG did not know what I am talking about (and asked for real examples…)
– some were telling me that those min distances are for my advantage (well, so far it was always to my disadvantage…)
– some were telling that they have to do it based on law (never came back to me after I was asking to provide a copy of that law…)
– some were telling “yes, every other broker does it and we do it as well” but were not willing to tell any details about why, when etc…
well, I can imagin or even understand why they are puting in place sometimes those min distances. I assume by that they are reducing their own risks, their own costs. but I don’t understand why they do not tell it to customers in some very transparent way. the fact that they put in place those min distances is bad enough – it turns a bit manipulated cfd “market” into heavily manipulated one, but I suppose we as customers have right to know it.
12/22/2023 at 12:58 PM #225617but I don’t understand why they do not tell it to customers in some very transparent way.
I’m sure I have read on IG website, something like … ‘during times of high volatility, the minimum distance will be increased’.
In the past I have experiuenced where I could not place a manual trade, even at 100’s of points away from the current market price. I kept getting the ‘min distance error message’.
My conclusion was / is that when IG’s books are out of balance beyond some threshold level then IG make it so further trades cannot be opened or even closed (manual & algo)!?
12/23/2023 at 8:22 PM #225665I hope somebody will disagree
I wouldn’t dare to disagree with you :- )
But those who are nevertheless tempted to use a set target loss statement, should NEVER launch it simultaneously with the order entry (buy, sellshort), be it at market or pending. This one is meant to be launched once in real trouble, when loss is already BIGGER than the distance supplied with the set target loss. For those who hope, like you said.12/29/2023 at 7:09 AM #225790I am using a stop loss on 30min timeframe but it is not working. Multiple algos have the same issue e.g.
12345IF NOT LONGONMARKET AND LongCondition THENBUY 1.0 CONTRACTS AT myLevel limitSET STOP PLOSS lossDistanceSET TARGET PPROFIT profDistanceENDIFSo, once order is executing on 1h timeframe, it is not leaving any pending orders based on above instructions. I cannot wait for an hour to re-evalute and then try putting a stop loss order in the code.
Please see attached an example where after 1h, my position has gone against me, so enforced a target profit profit to my starting position. I have not put stop loss in this one as this step gets executed during the next time the algo conditions get re-evaluated (ie 1h).
123IF LONGONMARKET AND CLOSE < myOpeningLevel THENSET TARGET BREAKEVENENDIFThe question remains the same. When order was first executed, why IG didn’t leave any pending order for stop loss and target profit. See also PRT picture. If you look at what happened:
- Order gets executed at 02:52 but no pending order for target profit and stop loss is left.
- 3am, new order start, so algo gets executed again, and now 2nd condition code is working i.e. set target breakeven.
My question is why no pending orders are being left at 02:52:xx as the position can go against you very quickly in fast moving environments.
12/29/2023 at 7:18 AM #22579312/29/2023 at 8:15 AM #22579412/29/2023 at 11:15 AM #225797Yes, ploss and pprofit are just points based on pipsize and in this example could be 30 or 40 points in case of nasdaq. They are not prices on the price scale.
Regarding putting
“set stop ploss x
set target porofit y”
outside the IF condition, thanks, I will give it a try. I was not aware of that. Is this the limitation or I didn’t read the documentation properly, may be later.
12/29/2023 at 11:27 AM #225798For all my algos, at the moment, set stop and set target are within the IF clause where condition is evaluated and trade is placed with limit order. It seems in such case, behaviour of setting stop and target is not deterministic.
In the attachment, two orders were fired from two different algos at around 10am with both having set stop and set profit within the IF clause. One of them has both stop n profit in place while other has just profit in place. While in the morning order of EURUSD, none were there. Quite strange.
12/29/2023 at 12:01 PM #225801Ash, you could say that this “outside of conditions” thing is for simplification (as in : first get things to work prior to make it more complicated).
Those commands are perfectly allowed to be within conditions, but the explanation of the conditions under which you now must operate, are beyond “knowledge”.
There’s really quite a bit involved like a necessity to reset a SL command with setting the SL to 0 (this is in the documentation, but nothing expects that If / Else conditions really apply it while you are on the edge of that desire). Or how things were explained to you in a fashion “from top to bottom in the program code”, which generally is true, but only comprehensible if you don’t apply conditions. Otherwise all is possible.
So the general advice is to make all mutual exclusive and explicit as you can. An example of not doing that :123If OnMarket thenSet Stop pLoss to MyAcceptedLossendifWhy is this ambiguous ? well, because when the Set Stop command has been executed once, it will remain forever. Or maybe not when the position exits. I don’t even know.
This would make it unambiguous, though maybe without much sense :
12345If OnMarket thenSet Stop pLoss to MyAcceptedLosselseSet Stop pLoss 0endifNow you will always know what happens.
The moral is : when you want to change these stops and targets underway, then this is perfectly allowed and your approach regarding this is fine. But you must must know what you are doing very well. Make all as mutual exclusive as possible. No ambiguity is allowed in your code, or else you may not be able to follow yourself, while the PRT interpreter just does what you told it to do.
Now justisan’s example :123456if … thenbuy 1 lot…endifset stop ploss xset target porofit yPrefectly clear ! But two small issues, when you’d ask me :
1. the Set Stop makes no sense when no position is in order; it is even dangerous because the amount of position may change while the Set Stop suggests a fixed distance (I know, with variable x this can be made variable);
2. It just does not allow for conditions, while you clearly want these.Ad 1.: I thus rather have the command right in the same If condition as where the Buy occurs. But only if the Set Stop will be dependent on that Buy. If not, we’d face another issue : redundancy. End if one thing is killing it is that.
Many roads lead to Rome, but you first need to know the roads very well in order to choose one.
12/29/2023 at 12:27 PM #225802At trying to observe similar to what you do, it could be so that this is bugging you ? See the two screenshots below;
Each one minute those first 3 lines change for the 3 according positions (the screenshots were made two minutes after each other). But, these lines obviously don’t change, they disappear from the list and are replaced with new ones.
I don’t deem this consistent with what you see in the 3rd screenshot, which is about cancelled / rejected orders. Except for the Trailing order, I see no difference in what I do in the code. Still, under that AutoTrading tab, PRT tracks each order-price change, and replaces the old one with the current one.
I actually never looked at that tab.All will IMO imply that when such n order stops placing a new pending order (like in my case each one minute, for these one minute TF codes) the line will disappear from the tab.
I think this could be your situation ?
And what if your code one over the other puts such an order ? I mean, the one minute it does, the next minute it does not. Then the one minute it does … and so on. Then it depends when you look at the list.
What about putting “System” (maybe also Version) there as a column ? that would give insight in this.PS: Copying the Tab headers comes handy for us, so we readily know what tab you made the screenshot of.
12/29/2023 at 12:27 PM #225806I generally use this approach …
1234567Defparam CumulateOrders - FalseIF LongCondition THEN //Not onMarket removedBUY 1.0 CONTRACTS AT myLevel limitSET STOP PLOSS lossDistanceSET TARGET PPROFIT profDistanceENDIF1 user thanked author for this post.
-
AuthorPosts
Find exclusive trading pro-tools on