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
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.
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.
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?
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
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;
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
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