Gamestudio Links
Zorro Links
Newest Posts
Data from CSV not parsed correctly
by EternallyCurious. 04/18/24 10:45
StartWeek not working as it should
by Zheka. 04/18/24 10:11
folder management functions
by VoroneTZ. 04/17/24 06:52
lookback setting performance issue
by 7th_zorro. 04/16/24 03:08
zorro 64bit command line support
by 7th_zorro. 04/15/24 09:36
Zorro FIX plugin - Experimental
by flink. 04/14/24 07:48
Zorro FIX plugin - Experimental
by flink. 04/14/24 07:46
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
2 registered members (flink, AndrewAMD), 656 guests, and 1 spider.
Key: Admin, Global Mod, Mod
Newest Members
EternallyCurious, howardR, 11honza11, ccorrea, sakolin
19047 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Page 2 of 7 1 2 3 4 5 6 7
Re: Pre-Market Volatility [Re: ] #426900
07/31/13 11:39
07/31/13 11:39
Joined: May 2013
Posts: 627
Bonn
Sundance Offline
User
Sundance  Offline
User

Joined: May 2013
Posts: 627
Bonn
Thats right. the code would be much better readable when using "else if".

One thing: When the following if clause

'if (price() <= (priceOpen() - 20))'

is true and you are running your script every tick and price will stay or move more downwards then you will open a trade every tick!? Don't understand why it hasn't done so...

Re: Pre-Market Volatility [Re: Sundance] #426901
07/31/13 11:45
07/31/13 11:45
Joined: Jul 2013
Posts: 75
R
royal Offline OP
Junior Member
royal  Offline OP
Junior Member
R

Joined: Jul 2013
Posts: 75
But "else if" would only open one trade and not three or?

Quote:
'if (price() <= (priceOpen() - 20))'

is true and you are running your script every tick and price will stay or move more downwards then you will open a trade every tick!? Don't understand why it hasn't done so...


It hasn't done so, because this condition is not working correctly I think wink

Re: Pre-Market Volatility [Re: royal] #426902
07/31/13 11:50
07/31/13 11:50
Joined: May 2013
Posts: 627
Bonn
Sundance Offline
User
Sundance  Offline
User

Joined: May 2013
Posts: 627
Bonn
I think we need help from JCL. I don't know if it makes sence to set the BarPeriod to 60 and set the TICKS flag at the same time.

I would consider to use some kind of flag for every tradelevel you use. so when you already entered short at price -20pips than set the flag (ex. ShortLevel2) to true. So you only take it once.

What does the script when you delete the BarPeriod line or set it to one?

Re: Pre-Market Volatility [Re: Sundance] #426904
07/31/13 11:58
07/31/13 11:58
Joined: Jul 2013
Posts: 75
R
royal Offline OP
Junior Member
royal  Offline OP
Junior Member
R

Joined: Jul 2013
Posts: 75
With BarPeriod 1 the trades are also entered at the same price frown

[GER30::L3400] Long 1@6976 Risk 37 at 08:55
[GER30::L3401] Long 1@6976 Risk 32 at 08:55
[GER30::L3402] Long 1@6976 Risk 27 at 08:55

Re: Pre-Market Volatility [Re: royal] #426905
07/31/13 12:08
07/31/13 12:08
Joined: Jul 2000
Posts: 27,978
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,978
Frankfurt
The brackets are not needed because the +/- operators have higher priority than <= or >=.

For having only one open trade, check the NumOpenLong / NumOpenShort variable and enter a new trade only when it's at 0. Alternatively, for entering only one trade, use "else if" conditions to make sure that only one trade is entered per bar, and start with the more distant conditions first.

And the buy price is not up to you I'm afraid. No matter how much code you write, it's always the price of the asset at the moment when you buy laugh.

Re: Pre-Market Volatility [Re: jcl] #426908
07/31/13 12:21
07/31/13 12:21
Joined: Jul 2013
Posts: 75
R
royal Offline OP
Junior Member
royal  Offline OP
Junior Member
R

Joined: Jul 2013
Posts: 75
But up to 3 trades should be opened, not just one, so NumOpenX == 0 is not the right solution here.

I am trying to implement this behavior:

1. Check the open price at 8 o'clock
2. When the price moves 15 pips up, open one short trade
3. When the price moves 20 pips up, open the second short trade
4. When the price moves 25 pips up, open the third short trade
5. All trades should have a stoploss 50 pips from 8 o'clocks opening price and a takeprofit at the 8 o'clock open price.
The long scenario vice versa.
Manually this would be done by pending orders.

Re: Pre-Market Volatility [Re: royal] #426909
07/31/13 12:25
07/31/13 12:25
Joined: Jul 2000
Posts: 27,978
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,978
Frankfurt
You need pending orders then.

Code:
var Price = priceClose();
TakeProfit = Price;
Stop = Price + 50*PIP;
enterShort(1,-15*PIP);
enterShort(1,-20*PIP);
enterShort(1,-25*PIP);


You need the TICKS flag here, as you're operating with very small entry/stop distances.

Last edited by jcl; 07/31/13 12:33.
Re: Pre-Market Volatility [Re: jcl] #426910
07/31/13 12:25
07/31/13 12:25
Joined: May 2013
Posts: 627
Bonn
Sundance Offline
User
Sundance  Offline
User

Joined: May 2013
Posts: 627
Bonn
I think royal wan't to take one trade per entrylevel. So when price moves down 30 pips from 08:00 o'clock. There will be three open short-trades near the levels he has in his if clauses...
so using pending trades would be the easiest thing to do :-)

Re: Pre-Market Volatility [Re: Sundance] #426911
07/31/13 12:32
07/31/13 12:32
Joined: May 2013
Posts: 627
Bonn
Sundance Offline
User
Sundance  Offline
User

Joined: May 2013
Posts: 627
Bonn
I see no problem using a TP at 8 o'clock level when the trade will be taken 15 or more pips above. What does concern me is the poor RR of up to 1:5 ...( SL 50pips and TP only ~9 pips away) ...

Re: Pre-Market Volatility [Re: Sundance] #426912
07/31/13 12:34
07/31/13 12:34
Joined: May 2013
Posts: 627
Bonn
Sundance Offline
User
Sundance  Offline
User

Joined: May 2013
Posts: 627
Bonn
Question jcl: Is it okay to set the BarPeriod when setting the TICKS level?

Page 2 of 7 1 2 3 4 5 6 7

Moderated by  Petra 

Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1