Hi all,
attached my problem that I want to avoid for not getting the trade at the same level of the previous.
The trade value is at a High candle
Somebody can you help me?
Thanks,
tradingest
To avoid the trade at the same previous price [SOLVED]
-
- Posts: 283
- Joined: 05 Dec 2014
- Location: Italy
- Has thanked: 53 times
- Been thanked: 3 times
To avoid the trade at the same previous price
- Attachments
-
- the_same_value.JPG
- (51.78 KiB) Downloaded 1360 times
-
- Posts: 283
- Joined: 05 Dec 2014
- Location: Italy
- Has thanked: 53 times
- Been thanked: 3 times
Re: To avoid the trade at the same previous price
A conditional statement included in your order generation commands as simple as the following would work
Or if you wanted to have entry perhaps a few ticks above a prior value you can use
Code: Select all
close <> entryprice(1) // if current price which is close doesn't equal entry price of the prior position
Code: Select all
( close - entryprice(1) ) > 5 * TickSize // If current price is 5 ticks above prior entry price.
-
- Posts: 283
- Joined: 05 Dec 2014
- Location: Italy
- Has thanked: 53 times
- Been thanked: 3 times
Re: To avoid the trade at the same previous price
Hi tony,
entryprice(1) to avoid the trade in the next day by previous price or this condition is always true also in the following days?
entryprice(1) to avoid the trade in the next day by previous price or this condition is always true also in the following days?
-
- Posts: 283
- Joined: 05 Dec 2014
- Location: Italy
- Has thanked: 53 times
- Been thanked: 3 times
Re: To avoid the trade at the same previous price
Hi tony,
I have read that entryprice (1) representing the number of positions ago. Perfect! That said my question is: this function entryprice consider the order place or the real price filled?
I work with limit order and the signal is generated from H(n). If I write code H (n) <>entryprice (1) is always verified because the entryprice is always different from H (n) due to slippage.
How I can make it?
thanks as always,
tradingest
I have read that entryprice (1) representing the number of positions ago. Perfect! That said my question is: this function entryprice consider the order place or the real price filled?
I work with limit order and the signal is generated from H(n). If I write code H (n) <>entryprice (1) is always verified because the entryprice is always different from H (n) due to slippage.
How I can make it?
thanks as always,
tradingest
- JoshM
- Posts: 2195
- Joined: 20 May 2011
- Location: The Netherlands
- Has thanked: 1544 times
- Been thanked: 1565 times
- Contact:
Re: To avoid the trade at the same previous price
If "H(n)" returns your limit price, you can also store that value in variable. Then, when the next limit order situation comes up, you can verify the then-current value of H(n) with the value stored in the variable. Or do I misunderstand completely?I work with limit order and the signal is generated from H(n). If I write code H (n) <>entryprice (1) is always verified because the entryprice is always different from H (n) due to slippage.
-
- Posts: 283
- Joined: 05 Dec 2014
- Location: Italy
- Has thanked: 53 times
- Been thanked: 3 times
- JoshM
- Posts: 2195
- Joined: 20 May 2011
- Location: The Netherlands
- Has thanked: 1544 times
- Been thanked: 1565 times
- Contact:
Re: To avoid the trade at the same previous price
What's the code that you already have? That also makes it a lot easier for us to give focused and concrete help.it's possible to have an example?
-
- Posts: 283
- Joined: 05 Dec 2014
- Location: Italy
- Has thanked: 53 times
- Been thanked: 3 times
Re: To avoid the trade at the same previous price
now I don't have the code. I'd like the generic example
- JoshM
- Posts: 2195
- Joined: 20 May 2011
- Location: The Netherlands
- Has thanked: 1544 times
- Been thanked: 1565 times
- Contact:
Re: To avoid the trade at the same previous price
I don't have the time to write (and test on real-time data) a trading strategy for you, and then incorporate any feedback you have.now I don't have the code. I'd like the generic example
Perhaps someone else can help you with that.
-
- Posts: 283
- Joined: 05 Dec 2014
- Location: Italy
- Has thanked: 53 times
- Been thanked: 3 times
Re: To avoid the trade at the same previous price
thanks for help but I hope that somebody is more pragmatic.
Nobody ask you to write the strategy for me but I want only hint.
Nobody ask you to write the strategy for me but I want only hint.
- JoshM
- Posts: 2195
- Joined: 20 May 2011
- Location: The Netherlands
- Has thanked: 1544 times
- Been thanked: 1565 times
- Contact:
Re: To avoid the trade at the same previous price
For a hint, I would code my previous comment like this:thanks for help but I hope that somebody is more pragmatic.
Nobody ask you to write the strategy for me but I want only hint.
Code: Select all
Variables:
IntrabarPersist prevLimitPrice(0),
IntrabarPersist currentLimitPrice(0),
IntrabarPerist goodToBuy(false);
// Assuming `enterLong` is only true once for each entry order
if (enterLong = true) then begin
currentLimitPrice = H(n);
goodToBuy = currentLimitPrice <> prevLimitPrice;
prevLimitPrice = currentLimitPrice;
end;
if (goodToBuy) then
Buy 1 contracts next bar at currentLimitPrice limit;
Re: To avoid the trade at the same previous price
Entry price would be the price you filled. So it should take in account any slippage, etc. But if you are using limit orders, then entry price and your limit price for the generated order should be identical and there should be no slippage in the first place.Hi tony,
I have read that entryprice (1) representing the number of positions ago. Perfect! That said my question is: this function entryprice consider the order place or the real price filled?
I work with limit order and the signal is generated from H(n). If I write code H (n) <>entryprice (1) is always verified because the entryprice is always different from H (n) due to slippage.
How I can make it?
thanks as always,
tradingest
And entryprice(1) would be the prior position so not necessarily for today but could be a prior day.
-
- Posts: 283
- Joined: 05 Dec 2014
- Location: Italy
- Has thanked: 53 times
- Been thanked: 3 times
Re: To avoid the trade at the same previous price
Hi Tony,
sorry I'm confused. I use stop order. This approach work the same?
tradingest
sorry I'm confused. I use stop order. This approach work the same?
tradingest
Re: To avoid the trade at the same previous price [SOLVED]
You said earlier you use limit orders. Regardless, entryprice returns the price you filled at per your broker. That may be different if you are not using SA mode, I don't know 100%. What you are trying to do is pretty straightforward and what Josh and I wrote above should clear up any issues you have. Part of the learning process is trying things in PLE, print out variables if needed to see if you are writing conditions correctly, etc and learn from your mistakes until you produce the outcome you desire. It's how all of us have learned and continue to learn. Good luck. You'll get it.Hi Tony,
sorry I'm confused. I use stop order. This approach work the same?
tradingest