# Define the current price of my open position

Forums ProRealTime English forum ProOrder support Define the current price of my open position

This topic contains 13 replies, has 5 voices, and was last updated by  GraHal 1 year ago.

Currently, there are 0 users and 1 guest visiting this topic.
View all attachments
Viewing 14 posts - 1 through 14 (of 14 total)
• #25354

Dear all, my name’s Giovanni and this is my first post in this forum.

I was wondering if, using an automatic trading system, I can manage my open position in this way:

1. identify current price of my open position
2. move an order accordingly to my actual price, without waiting the end of the bar.

let me give an example: I run my system with a timeframe = 1 day and when market opens, I open a long position and define a stop as a sell order “stop” at level L1 (obviously < of opening price).

If market goes up in the same day, let’s say 20 pips up, I want to move up my sell order of 20 pips, to set risk to zero.

Again in the same day, price moves up 15 pips again, and I want to move up my stop order by 15 pips and so on.

just to recap: I’d like to simulate a trailing stop in the same bar, managing the stop level at my will.

Does anybody has faced a similar issue and found a solution?

thank you all

#25358

So you want this to be done automatically by a code in your own automatic trading strategy?

#25373

Hi Nicolas, yes right.

It’s quite difficult to me to find a way to move the exit order during the candle development, that is what the trailing stop does.

Any suggestion?

thank you!

#25374

Ok, so the TRAILING STOP instruction should be exactly what you need, since once  the trailing is set @ IG, their servers will do the rest.

#25385

ok, but the TRAILING STOP give me a well defined and always equal movement.

in this way the stop is moved closer to the price at each pip variation, correct?

in case of a long position: what if I want a Trailing stop moving from a Fibonacci’s level to the following one, only when the price touch an higher fibonacci level?

e.g. initial stop at the bottom of the previous candle (simple to set). The price moves up, touching the first Fibo extension (138%), I want to move my stop to the open price, to eliminate the trading risk. The price moves again up, touching the second extension (161%) and I want to move my stop to the first Fibo extension (138%) and so on…

#25398

Fibonacci extensions calculated from which high and low levels?

#25403

High level: open price

Low level: the low of the previous bar

#25438

Ok but doing calculation and moving the stoploss accordingly to the Fibonacci levels will not be done inside a bar. Until we do not have multitimeframe support (which will come in the first half of this year hopefully), we can’t do much more here :/

#25671

thanks Nicolas, so let’s wait for the multitimeframe.

#93878

e.g. initial stop at the bottom of the previous candle (simple to set). The price moves up, touching the first Fibo extension (138%), I want to move my stop to the open price, to eliminate the trading risk. The price moves again up, touching the second extension (161%) and I want to move my stop to the first Fibo extension (138%) and so on…

Hi @barbagio,

have you been able to code this trailing stop; I coded this but it does not work in IG; the trailing Stop il not following the levels of Fibo ;-( do you have any clue why?

@nicolas

Hi Nicolas,

do you have a hint for this ?

Cheers

#93883

You don’t need lines 6 and 38. This will stop the pending sell order from being placed until the bar you enter the market on has closed. Maybe you intend for it the trailing stop not to be activated until one bar has closed?

I’m not sure if this is the reason why it is not working as you think it should though. I would double check your fibo levels using GRAPHONPRICE.

#93933

Is there more code we are not seeing?  Is my coffee not working? 🙂

You have not defined the fibo levels (fibo236, 382 etc) or the div??

#93939

Is there more code we are not seeing?

Simple answer = yes! Kris75 has not included the calculations for the fibonacci levels, the position size or the value of div. However we can see the basics of his idea for setting stop levels which should work once one bar has closed so my guess is that the fibonacci levels are not correctly calculated or there is something else in the code that we can’t see. Sharing the complete code would be helpful but as we know not everyone likes sharing complete codes!

Have another coffee…

#93974

Sharing the complete code would be helpful but as we know not everyone likes sharing complete codes!

This may be a good one to work on collaboratively as it’s not as if Fib levels are any of our own ideas.

Also I can understands the code / strategy (surprisingly! 🙂 )  which is why I was asking as I think @Kris75 has not worked out the fib levels calcs and he is asking for help?

So which is it Kris75 …

• You have coded up the full strategy (but it’s not working)
• OR
• You need help further than the code you show above?

Viewing 14 posts - 1 through 14 (of 14 total)