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, dr_panther), 1,282 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
Page 4 of 4 1 2 3 4
Re: Please, help with Fractal indicator. [Re: jcl] #415323
01/17/13 11:54
01/17/13 11:54
Joined: Jan 2013
Posts: 26
Italy
M
Maruska Offline OP
Newbie
Maruska  Offline OP
Newbie
M

Joined: Jan 2013
Posts: 26
Italy
I read the manual, but priceClose() means priceClose(0) and it's the close price of the the last closed canlde, right?

Re: Please, help with Fractal indicator. [Re: Maruska] #415324
01/17/13 12:13
01/17/13 12:13
Joined: Jul 2000
Posts: 27,986
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,986
Frankfurt
priceClose(0) is always the last received price quote. When the last candle has just closed, as is normally the case, it's also the price at which the candle has just closed.

Re: Please, help with Fractal indicator. [Re: jcl] #415378
01/17/13 21:44
01/17/13 21:44
Joined: Jan 2013
Posts: 26
Italy
M
Maruska Offline OP
Newbie
Maruska  Offline OP
Newbie
M

Joined: Jan 2013
Posts: 26
Italy
Ok, thanks.
I begin to understand more about zorro's functioning.

Another question:
If I have more than one order opened how Can I close only one particolar order?

I read on the manual the function "exitTrade (TRADE* trade, var price)" but I don't know how to retriev "trade" variable.

I have some like this:

for(open_trades)
if(strstr(TradeAsset,Asset) && TradeIsOpen)
if(TradeIsLong && ((Bid - priceClose(0)) > (PipsProfit*PIP)))
exitLong();
else if(TradeIsShort && ((priceClose(0) - Ask) > (PipsProfit*PIP)))
exitShort();

but I want to close only the order that matches the condition.

Thanks

Last edited by Maruska; 01/17/13 21:45.
Re: Please, help with Fractal indicator. [Re: Maruska] #415406
01/18/13 07:43
01/18/13 07:43
Joined: Jul 2000
Posts: 27,986
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,986
Frankfurt
Your code above is correct for closing only the order that matches the condition, but it runs only once per bar. You might want to do that in a trade function, for closing the trade as soon as the condition is met.

For closing a particular order, you can retrieve the TRADE* pointer from the enter command:


TRADE* my_order = enterLong();
...
exitTrade(my_order,0);

Re: Please, help with Fractal indicator. [Re: jcl] #415412
01/18/13 10:16
01/18/13 10:16
Joined: Jan 2013
Posts: 26
Italy
M
Maruska Offline OP
Newbie
Maruska  Offline OP
Newbie
M

Joined: Jan 2013
Posts: 26
Italy
I have tested it in real time in a demo account and when the condition is met, it close all long orders (or short orders).

What do you mean about "trade function"?

If I have a lot of orders opened and I don't have set the variable "TRADE* my_order" for each order; is there a way to retriev it for the order I am checking?

Re: Please, help with Fractal indicator. [Re: Maruska] #415470
01/19/13 10:21
01/19/13 10:21
Joined: Jul 2000
Posts: 27,986
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,986
Frankfurt
A trade function is for fine control of trade entry and exit - for details, check out enterLong/Short in the manual. You normally use a trade function, and not a for(open_trades) loop, for exiting a trade under a trade-specific condition. The advantage is that a trade function can react on any tick.

The pointer of the current trade in the for(open_trades) loop is g->tr, so for closing only a particular order, use exitTrade(g->tr,0).

Page 4 of 4 1 2 3 4

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