Set Target based on volume
Forums › ProRealTime English forum › ProOrder support › Set Target based on volume
- This topic has 9 replies, 3 voices, and was last updated 3 years ago by
RichardVeen.
-
-
01/30/2022 at 3:22 PM #187075
Hi,
Is it possible to set the target based on volume change?
For example:
The idea is: Set the initial target to 10 points but when the volume reaches 10.000 points in the current bar, then the target changes to 25 points.
I tested with the code below:
//profit & loss
if Volume > 10000 then
SET TARGET PROFIT 25
else
SET TARGET PROFIT 10With this code, the target is set based on the previous bar. So if the volume of the previous bar is > 10.000 then the trade
begins and the target is immediately set to 25.But the idea is that, when the trade begins, the initial target is set for 10 points and if the volumes is > 10.000,
the target is automatically set to 25.Is that possible?
01/31/2022 at 2:50 PM #187125There you go:
1234567IF MyLongConditions THENBUY 1 CONTRACT AT MARKETSET TARGET pPROFIT 10 //or SET TARGET PROFIT 10 * PipSizeENDIFIF Volume > 10000 THENSET TARGET pPROFIT 25 //or SET TARGET PROFIT 25 * PipSizeENDIF01/31/2022 at 5:04 PM #187134Thanks @robertogozzi!
I testen and the code is working but when the trade starts, the Target is immediately set to 25. I think it is looking to the previous Volume candle.
Is the scenario below possible:
– The trade starts
– Target is set 10
– Volume is building up (1,2,10,28,89,136,1450,3378,6980….10.000) -> so the target is still 15
– Volume is > 10.000 ( f.e. 11289…)
– Target is changing to 25I used the code mentioned below to test:
12345678910111213141516171819202122//order launch (example) would be set to any other entry conditionsc1 = close>close[1]if c1 AND CLOSE>MA thenBUY 1 LOT AT MARKETSET TARGET pPROFIT 10ENDIFIF Volume > 10000 THENSET TARGET pPROFIT 25ENDIF//order launch (example) would be set to any other entry conditionsc2 = close<close[1]if c2 AND CLOSE<MA thenSELLSHORT 1 LOT AT MARKETSET TARGET pPROFIT 10ENDIFIF Volume > 10000 THENSET TARGET pPROFIT 25ENDIFDid I something wrong?
01/31/2022 at 5:54 PM #187137Richard, did you actually check what the volume *is* ? If it is 100000 then it would right away trigger the condition in the same (current !) bar.
Besides that, it looks like you want the Target raised when the evolvement of the current bar (of say 10 minutes) depicts that. That is not possible, although working with Multiple Timeframes would allow for it indirectly.
I think it is looking to the previous Volume candle.
Thus nope (Yes actually 😉 ), if the volume of the previous candle is 100000, the Target would go to 25 right away. But all you can ever look at *is* the previous candle.
Your code is called at the end of the last candle.
So I suspect your volume is so high always, or at least during the moments you are testing this.1Graph Volume01/31/2022 at 5:56 PM #187138Volume is the Volume traded in one bar of the chosen time frame, it can be 10000 from the start!
What do you mean by Volume is building up (1,2,10,28,89,136,1450,3378,6980….10.000) ?
01/31/2022 at 6:39 PM #187154Hi,
At the start of every trade, the volume starts with ‘0’.
What I mean is that if the volume raises, in the current bar, up to 10000 then it triggers to set the target from 10 to 25.
See attached screenshots of the volume bar.01/31/2022 at 7:26 PM #18716201/31/2022 at 8:11 PM #187168Thanks @PeterSt, it is clear to me.
01/31/2022 at 8:29 PM #187169Maybe you mean one of these two:
#1123456789101112131415161718192021//order launch (example) would be set to any other entry conditionsc1 = close>close[1]if c1 AND CLOSE>MA thenBUY 1 LOT AT MARKETSET TARGET pPROFIT 10MyVolume = VolumeENDIF//order launch (example) would be set to any other entry conditionsc2 = close<close[1]if c2 AND CLOSE<MA thenSELLSHORT 1 LOT AT MARKETSET TARGET pPROFIT 10MyVolume = VolumeENDIF//IF (MyVolume + Volume) > 10000 THENSET TARGET pPROFIT 25ENDIF#212345678910111213141516171819//order launch (example) would be set to any other entry conditionsc1 = close>close[1]MyVolume = MyVolume + Volumeif c1 AND CLOSE>MA thenBUY 1 LOT AT MARKETSET TARGET pPROFIT 10MyVolume = 0ENDIF//order launch (example) would be set to any other entry conditionsc2 = close<close[1]if c2 AND CLOSE<MA thenSELLSHORT 1 LOT AT MARKETSET TARGET pPROFIT 10MyVolume = 0ENDIF//IF OnMarket AND MyVolume > 10000 THENSET TARGET pPROFIT 25ENDIF02/02/2022 at 8:40 PM #187403Hi @robertogozzi,
I have tested both codes and both codes works but when the volume is > 10000, the target don’t change in the current bar. The code looks only to the volume from the previous bar.
Thanks for your help!
-
AuthorPosts
Find exclusive trading pro-tools on