Gamestudio Links
Zorro Links
Newest Posts
Change chart colours
by 7th_zorro. 05/11/24 09:25
Data from CSV not parsed correctly
by dr_panther. 05/06/24 18:50
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
2 registered members (AndrewAMD, VoroneTZ), 1,258 guests, and 4 spiders.
Key: Admin, Global Mod, Mod
Newest Members
Hanky27, firatv, wandaluciaia, Mega_Rod, EternallyCurious
19051 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Pending order problems #462792
10/29/16 08:04
10/29/16 08:04
Joined: Jul 2016
Posts: 27
K
konorti Offline OP
Newbie
konorti  Offline OP
Newbie
K

Joined: Jul 2016
Posts: 27
Does anybody know what might be the problem entering not just at certain levels with pending order by the code:

function run()
{
StartDate = 20151001;
EndDate = 20151005;
LookBack = 105;

static var BuyLimit,SellLimit;
EntryTime = 1;
ExitTime = 2;


if(!NumOpenLong && !NumPendingLong)
{
enterLong(1,9500);
}
if(!NumOpenShort && !NumPendingShort)
{
enterShort(1,9700);
}

}



Re: Pending order problems [Re: konorti] #462815
10/30/16 02:33
10/30/16 02:33
Joined: Apr 2014
Posts: 482
Sydney, Australia
B
boatman Offline
Senior Member
boatman  Offline
Senior Member
B

Joined: Apr 2014
Posts: 482
Sydney, Australia
If you have a buy/sell stop order that is above/below the current price, Zorro will automatically open the trade at market. It looks like that is what is happening here. You can try adding an additional condition to your if statement:

if(!NumOpenLong && !NumPendingLong && priceClose(0) < 9500)
{
enterLong(1,9500);
}

I think that should help.

Re: Pending order problems [Re: boatman] #462818
10/30/16 12:27
10/30/16 12:27
Joined: Jul 2016
Posts: 27
K
konorti Offline OP
Newbie
konorti  Offline OP
Newbie
K

Joined: Jul 2016
Posts: 27
Thanks! I tried also to enter limit orders and had to enter 9500<priceOpen(0) in the if statement as well, otherwise it opened too many trades again.
Still one issue remained that why not enterred buy trade 1 bar before (e.g. the bearish long candle piercing through level 9500)?
Code:
function run()
{
	StartDate = 20151001;
	EndDate = 20151005;
	LookBack = 105;	
	 
	static var BuyLimit,SellLimit;
	EntryTime = 50;
	ExitTime = 2;
set(PARAMETERS+TICKS);
	
	if(!NumOpenLong && !NumPendingLong && priceClose(0)<9500 && 9500 < priceOpen(0)) //
	   {
		enterLong(1,9500);
	}
}



Re: Pending order problems [Re: konorti] #462823
10/31/16 01:16
10/31/16 01:16
Joined: Apr 2014
Posts: 482
Sydney, Australia
B
boatman Offline
Senior Member
boatman  Offline
Senior Member
B

Joined: Apr 2014
Posts: 482
Sydney, Australia
I might be wrong, but it looks like you are trying to set a stop and a limit order with the same enterLong() function.
In order to enter a limit order, use the negative of the entry price. For example:

Code:
...
Entry = -9500;
enterLong();
...



This will set a buy limit order at 9500. You might also want to add a condition that ensures price is above this level before setting your limit order.

If you want both buy stop and buy limit orders, you will need to use separate enterLong() calls. For example:

Code:
...
Entry = -9500; //limit order
enterLong();
Entry = 9500; //stop order
enterLong();
...



Hope that helps!

Re: Pending order problems [Re: boatman] #462828
10/31/16 06:56
10/31/16 06:56
Joined: Jul 2016
Posts: 27
K
konorti Offline OP
Newbie
konorti  Offline OP
Newbie
K

Joined: Jul 2016
Posts: 27
Thanks! Negative price worked! Where did you get the info, i didnt read this in the manual.

Re: Pending order problems [Re: konorti] #462829
10/31/16 08:15
10/31/16 08:15
Joined: May 2015
Posts: 390
Czech Republic
G
Grat Offline
Senior Member
Grat  Offline
Senior Member
G

Joined: May 2015
Posts: 390
Czech Republic


Moderated by  Petra 

Powered by UBB.threads™ PHP Forum Software 7.7.1