Gamestudio Links
Zorro Links
Newest Posts
Free Live Data for Zorro with Paper Trading?
by AbrahamR. 05/18/24 13:28
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 (AbrahamR, 1 invisible), 858 guests, and 6 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
Heiken-Ashi Indicator #442651
06/28/14 04:12
06/28/14 04:12
Joined: Jan 2014
Posts: 41
K
killerkhan Offline OP
Newbie
killerkhan  Offline OP
Newbie
K

Joined: Jan 2014
Posts: 41
Helo jcl, how do I code Heiken-Ashi Indicator in zorro s?

http://www.dailyfx.com/forex/education/t..._Indicator.html

how would I convert something like this pseudo code into zorro lite-c code?

===================
== Entry conditions
===================
LongEntryCondition = ((Open(9) > HeikenAshiLow(17)) Or (ATR(76) Crosses Below ATR(67)))
ShortEntryCondition = ((Open(9) < HeikenAshiHigh(17)) Or (ATR(76) Crosses Above ATR(67)))


===================
== Entry orders
===================
-- Long entry
if LongEntryCondition is true {
Reverse existing order (if any) and Buy on open at Market;
Stop Loss = 98 pips;
}

-- Short entry
if ShortEntryCondition is true {
Reverse existing order (if any) and Sell on open at Market;
Stop Loss = 98 pips;
}

Re: Heiken-Ashi Indicator [Re: killerkhan] #442700
06/30/14 10:35
06/30/14 10:35
Joined: Jul 2000
Posts: 27,986
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,986
Frankfurt
Pseudo code is easily converted to Zorro Code. For Haikin Ashi:

Close = (Open+High+Low+Close)/4
Open = [Open (previous bar) + Close (previous bar)]/2
High = Max (High,Open,Close)
Low = Min (Low,Open, Close)

==>

vars Close = series((priceOpen()+priceHigh()+priceLow()+priceClose())/4);
vars Open = series((priceOpen(1)+priceClose(1))/2);
vars High = series(max(priceHigh(),max(priceOpen(),priceClose())));
vars Low = series(min(priceLow(),min(priceOpen(),priceClose())));

Only take care to count correctly the number of brackets. wink


Moderated by  Petra 

Powered by UBB.threads™ PHP Forum Software 7.7.1