Gamestudio Links
Zorro Links
Newest Posts
Data from CSV not parsed correctly
by jcl. 04/26/24 11:18
M1 Oversampling
by jcl. 04/26/24 11:12
Why Zorro supports up to 72 cores?
by jcl. 04/26/24 11:09
Eigenwerbung
by jcl. 04/26/24 11:08
MT5 bridge not working on MT5 v. 5 build 4160
by EternallyCurious. 04/25/24 20:49
Trading Journey
by howardR. 04/24/24 20:04
Zorro FIX plugin - Experimental
by flink. 04/21/24 07:12
Scripts not found
by juergen_wue. 04/20/24 18:51
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
5 registered members (Petra, AndrewAMD, VoroneTZ, 2 invisible), 822 guests, and 5 spiders.
Key: Admin, Global Mod, Mod
Newest Members
Mega_Rod, EternallyCurious, howardR, 11honza11, ccorrea
19048 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Custom Indicator: Envelope Channel #467439
08/02/17 15:39
08/02/17 15:39
Joined: Feb 2017
Posts: 24
sodiumchloride Offline OP
Newbie
sodiumchloride  Offline OP
Newbie

Joined: Feb 2017
Posts: 24
Hey guys,
as I received a lot of help – I want to share a my “fresh” simple custom indicator with you. I have not yet used it for trading. But maybe soon…
Code:
// Envelope Channel
#include <default.c> 	// see http://www.zorro-trader.com/manual/en/include.htm
var ECDeviation; 	// custom parameter for deviation of the bands (could be two diff.)
int SMA_Period;	// period of the SMA
var EChannel(var* Data, int SMA_Period, var ECDeviation)		// usual function calling
{
	rRealUpperBand = (SMA(Data, SMA_Period) * (1 + ECDeviation/100));	// “official” formula
	rRealLowerBand = (SMA(Data, SMA_Period) * (1 - ECDeviation/100));	// same
	return rRealUpperBand;						// like DC indicator
}


Afterwards i just expanded the “Donchian Channel Indicator” but it still took me some time to code it.
Step by step:
1. Create a file name “myindicator_1.c” in the Zorro/Include folder
2. Copy the posted code and save file
3. Add #include <myindicator_1> at the beginning of your script
4. Call the function via EChannel(var* Data, int SMA_Period, var ECDeviation) with your individual paramters.
5. The function returns both bands, which you can then plot f.e.

Example:
Code:
// IndicatorTest2 ///////////////////
#include <myindicators.c>
function run()
{
	set(PLOTNOW);
	StartDate = 20170802;
	BarPeriod = 1;
	vars Price = series(price());
	
// plot Envelope Channel
	EChannel(Price,20,0.1);
	plot("EChannelUp",rRealUpperBand,BAND1,RED);
	plot("EChannelDown",rRealLowerBand,BAND2,GREY);
}



I know, this indicator is nothing special. But i didnt find a good example for a custom indicator usage somewhere.

P.S. i hope everything is done "efficient" and feel free to comment

Re: Custom Indicator: Envelope Channel [Re: sodiumchloride] #467462
08/04/17 01:51
08/04/17 01:51
Joined: Dec 2016
Posts: 71
F
firecrest Offline
Junior Member
firecrest  Offline
Junior Member
F

Joined: Dec 2016
Posts: 71
Thank you. I understand there are some strategies that can use this. Example, when the price hit the upper channel, it will be the price target for long strategy.


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