Gamestudio Links
Zorro Links
Newest Posts
Help with plotting multiple ZigZag
by degenerate_762. 04/30/24 23:23
M1 Oversampling
by 11honza11. 04/30/24 08:16
Trading Journey
by howardR. 04/28/24 09:55
Zorro Trader GPT
by TipmyPip. 04/27/24 13:50
Data from CSV not parsed correctly
by jcl. 04/26/24 11:18
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
2 registered members (Ayumi, AndrewAMD), 833 guests, and 1 spider.
Key: Admin, Global Mod, Mod
Newest Members
firatv, wandaluciaia, Mega_Rod, EternallyCurious, howardR
19050 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Page 3 of 4 1 2 3 4
Re: Donchian Channel Indicator [Re: hughbriss] #410024
10/26/12 21:17
10/26/12 21:17
Joined: Oct 2012
Posts: 75
H
hughbriss Offline OP
Junior Member
hughbriss  Offline OP
Junior Member
H

Joined: Oct 2012
Posts: 75
D'oh! Ok, I've worked it out... I need to use [1] rather than [0]. You see, I'm not that stupid, just a little slow...

Re: Donchian Channel Indicator [Re: hughbriss] #410043
10/27/12 07:18
10/27/12 07:18
Joined: Sep 2003
Posts: 929
Spirit Offline

Moderator
Spirit  Offline

Moderator

Joined: Sep 2003
Posts: 929
Hmm I see nothing wrong in your code and dont see why you think you need to use [1], but maybe you wanted a crossOver() of the price instead of just comparing it? Your comparing will enter trades all the time on every bar, but crossover only enters it when the price crosses over the border.

Re: Donchian Channel Indicator [Re: Spirit] #410049
10/27/12 10:03
10/27/12 10:03
Joined: Oct 2012
Posts: 75
H
hughbriss Offline OP
Junior Member
hughbriss  Offline OP
Junior Member
H

Joined: Oct 2012
Posts: 75
Originally Posted By: Spirit
Hmm I see nothing wrong in your code and dont see why you think you need to use [1], but maybe you wanted a crossOver() of the price instead of just comparing it? Your comparing will enter trades all the time on every bar, but crossover only enters it when the price crosses over the border.


Using the [1] will compare the previous value of the DChannel rather than the current one which by necessity will have risen or fallen in line with the price and therefore will never be exceeded.

The trade count criteria prevent multiple trades being opened.

Last edited by hughbriss; 10/27/12 10:04.
Re: Donchian Channel Indicator [Re: hughbriss] #410130
10/28/12 20:13
10/28/12 20:13
Joined: Oct 2012
Posts: 75
H
hughbriss Offline OP
Junior Member
hughbriss  Offline OP
Junior Member
H

Joined: Oct 2012
Posts: 75
Maybe anyone watching may have already worked this out but I was using = in the if statements when I needed ==

This will come to me slowly. If you never give up at anything no matter how bleak things look you will eventually get there.

Re: Donchian Channel Indicator [Re: hughbriss] #410152
10/29/12 14:52
10/29/12 14:52
Joined: Jul 2000
Posts: 27,986
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,986
Frankfurt
Not only that, you also used "numLong" instead of "numLong(0)". Both are valid C expressions, but numLong is the pointer of the numLong() function.

We have removed numLong() from the documentation because it is not needed. The number of trades and all other trade statistics are directly available as variables:

http://manual.zorro-trader.com/winloss.htm

Re: Donchian Channel Indicator [Re: jcl] #410184
10/30/12 08:20
10/30/12 08:20
Joined: Oct 2012
Posts: 75
H
hughbriss Offline OP
Junior Member
hughbriss  Offline OP
Junior Member
H

Joined: Oct 2012
Posts: 75
Yes, I worked that out as well eventually.

Another question. I know that with an ma cross system as soon as you start trading short the long trades are exited. With thi donch channel system where you are using a different criteria for the entry and exit would the exitLong() function close all open long trades if you had added on or would I need to put in some kind of loop to count the number of open longs and keep closing them until they were all closed?

Re: Donchian Channel Indicator [Re: hughbriss] #410192
10/30/12 10:35
10/30/12 10:35
Joined: Jul 2000
Posts: 27,986
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,986
Frankfurt
exitLong() closes all open long trades with the same asset and algo, so you need no loop.

Re: Donchian Channel Indicator [Re: jcl] #410239
10/30/12 23:59
10/30/12 23:59
Joined: Sep 2012
Posts: 99
T
TankWolf Offline
Junior Member
TankWolf  Offline
Junior Member
T

Joined: Sep 2012
Posts: 99
Originally Posted By: jcl
Well, according to the algorithm the +DI & -DI crossing is just the zero crossing of the DX, so you should be able to use those strategies. That's probably the reason why the TA-Lib author did not care to store +DI & -DI separately.


Quote:

775 /* Generated */ if( !TA_IS_ZERO(prevTR) )
776 /* Generated */ {
777 /* Generated */ minusDI = round_pos(100.0*(prevMinusDM/prevTR));
778 /* Generated */ plusDI = round_pos(100.0*(prevPlusDM/prevTR));
779 /* Generated */ tempReal = minusDI+plusDI;
780 /* Generated */ if( !TA_IS_ZERO(tempReal) )
781 /* Generated */ {
782 /* Generated */ tempReal = round_pos(100.0*(std_fabs(minusDI-plusDI)/tempReal));


jcl Ive tried to work out how to use the +DI and -DI values but I just cant seem to work it out, its a vital aspect to one of my strategies that I check that the +DI and -DI have crossed before a trade can be taken. Any further help would be appreciated or anyone for that matter. tongue

Re: Donchian Channel Indicator [Re: TankWolf] #410249
10/31/12 07:41
10/31/12 07:41
Joined: Jul 2000
Posts: 27,986
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,986
Frankfurt
var *DX20 = series(DX(20));

if(CrossOver(DX20,0.0)) ... // +DI crossed -DI

if(CrossUnder(DX20,0.0)) ... // -DI crossed +DI

Hope this helps.

Re: Donchian Channel Indicator [Re: jcl] #410259
10/31/12 09:14
10/31/12 09:14
Joined: Sep 2012
Posts: 99
T
TankWolf Offline
Junior Member
TankWolf  Offline
Junior Member
T

Joined: Sep 2012
Posts: 99
Im trying that and no trades are excuteing at all now.

The DX value reads:
Quote:

DX(int TimePeriod): var
Directional Movement Index by Welles Wilder (the guy who claimed that "the interaction of sun, moon, and earth is the basis of all market movement"). If sun, moon, and earth don't work, use this indicator. The values range from 0 to 100, but rarely get above 60. A high return value is supposed to indicate a strong trend, a low value a weak trend.


So if the DX value can only return a value between 0 and 100 how can it ever cross under or over 0?

Page 3 of 4 1 2 3 4

Moderated by  Petra 

Powered by UBB.threads™ PHP Forum Software 7.7.1