moving sell or buy stop (not trailing stop)
Forums › ProRealTime English forum › ProOrder support › moving sell or buy stop (not trailing stop)
- This topic has 6 replies, 3 voices, and was last updated 4 years ago by Vonasi.
-
-
12/13/2020 at 4:42 PM #153589
Hi, Would appreciate anyone that can help on this.
So I have the following buy code,
12345IF NOT LongOnMarket AND LongEntry THENBUY 1 CONTRACTS AT MARKETset stop ploss longSLENDIFLongEntry is the event with lime green background color and the first one is my buy position with a 9.1 pips stop loss. As you can see, there will be multiple events of LongEntry, and each one there’s a corresponding “LongSL” drawn with a segment and pips measure (i.e. 4.8, 4.4 and 4.8.
What I want to do is to either to get the lowest LongSL in this case, 4.4pips (longSL can also be calculated as a price) OR get the latest LongSL – the 4.8pips or 104.066 – as my exit signal. I cannot use a trailing stop loss because I work with guaranteed sto loss which are normally farther than my LongSL price. Is there a possible solution to this? Im thinking of a counter of the event so I can get the latest one but I dont know how to do it.
thanks for anyone who find time to reply.
12/13/2020 at 5:13 PM #153593To get the lowest longSL you can write:
1longSL = min(longSL,longSL_calculation)but I an not sure that’s what you want.
A text example would be of greater help.
12/14/2020 at 2:13 AM #153626LongSL is calculated as
1234LongSL=(Close-DonchianDown)/pipsize and LongEntryLongEntry=Close crossses over TenkanPriCeSL=(Close-DonchianDown) and LongEntryThere will be multiple events of LongEntry like in this scenario, 4 times (see picture). The first one is my buy entry and with first LongSL asssigned as my stoploss.
Now, what I want is to get the min of the suceeding LongSL (in pips) or PriceSL (price) to be exit scenario i.e 104.066
The other option is to get the latest PriceSL as my exit point.
12/14/2020 at 4:27 AM #153627To get the lowest among LongSL and PriceSL:
1LongSL = min(longSL,min(longSL[1],min(PriceSL,PriceSL[1])))but as you have combined that calculation with a logical operator, you will instead get either 0 or 1.
Moreover, at line 4 you did not use PIPSIZE (that you used at line 1) thus probably making my line of code fail in some cases.
If you want to be helped you need to post your code or be accurate when posting details, otherwise we can only guess.
12/14/2020 at 7:46 AM #153629Apology if I provide confusion for adding the PriceSL, it is not on my original code but added since I realized that the new exit cannot be based on pips but price
123456789101112131415161718192021222324Tenkan =(highest[9](high)+lowest[9](low))/2DonchianDown=LOWEST[20](LOW[1])LongEntry=Close crossses over TenkanShortEntry= Close crossses under TenkanLongSL=(Close-DonchianDown)/pipsize and LongEntryPriCeSL=(Close-DonchianDown) and LongEntryIF NOT LongOnMarket AND LongEntry THENBUY 1 CONTRACTS AT MARKETset stop ploss longSLendif//this is the one I don’t know how to solve.movingSL=If LongOnMarket AND ShortEntry and movingSL THENSELL AT MARKETENDIFENDIFso from the above, what I am trying to find is to have another exit point (MovingSL). I will exit my position if the Price crossess under movingSL
I intended to have the MovingSL as either:
- the highest (correction from my initial post) of the previous PriceSL that happne
- OR the latest one PriceSL recorded.
From the attahcment you can see, 4 events of the PriceSL. The first one is my entry point (LongEntry).
In both option since highest is also the latest PriceSL on this picture, exit pooint should be earlier at 104.066 and not on 104.041 which is the set stop loss.
12/16/2020 at 7:06 AM #15390712/16/2020 at 9:22 AM #153920theo123 – Topic moved to ProOrder forum as it is a strategy topic and not an indicator topic. Please try to post in the correct forum with any future topics.
_ ProRealTime Platform Support: only platform related issues.
_ ProOrder: only strategy topics.
_ ProBuilder: only indicator topics.
_ ProScreener: only screener topics
_ General Discussion: any other topics.
_ Welcome New Members: for new forum members to introduce themselves. -
AuthorPosts
Find exclusive trading pro-tools on