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
4 registered members (AndrewAMD, ozgur, AbrahamR, wdlmaster), 849 guests, and 7 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
eqF - FuzzyRange meaning #473002
06/07/18 09:00
06/07/18 09:00
Joined: Feb 2018
Posts: 68
T
tomaslolo Offline OP
Junior Member
tomaslolo  Offline OP
Junior Member
T

Joined: Feb 2018
Posts: 68
Hi all, keep learning and enjoying with Zorro. Now trying to understand eqF:

For "Pattern Analyzer", from the manual (http://www.zorro-trader.com/manual/en/advisor.htm)
Quote:
int EURUSD_S(float* sig)
{
if(sig[1]<sig[2] && eqF(sig[2]-sig[4]) && sig[4]<sig[0] && sig[0]<sig[5] && sig[5]<sig[3]
&& sig[10]<sig[11] && sig[11]<sig[7] && sig[7]<sig[8] && sig[8]<sig[9] && sig[9]<sig[6])
return 19;
if(sig[4]<sig[1] && sig[1]<sig[2] && sig[2]<sig[5] && sig[5]<sig[3] && sig[3]<sig[0] && sig[7]<sig[8]
&& eqF(sig[8]-sig[10]) && sig[10]<sig[6] && sig[6]<sig[11] && sig[11]<sig[9])
return 170;
if(sig[1]<sig[4] && eqF(sig[4]-sig[5]) && sig[5]<sig[2] && sig[2]<sig[3] && sig[3]<sig[0]
&& sig[10]<sig[7] && eqF(sig[7]-sig[8]) && sig[8]<sig[6] && sig[6]<sig[11] && sig[11]<sig[9])
return 74;
if(sig[1]<sig[4] && sig[4]<sig[5] && sig[5]<sig[2] && sig[2]<sig[0] && sig[0]<sig[3] && sig[7]<sig[8]
&& eqF(sig[8]-sig[10]) && sig[10]<sig[11] && sig[11]<sig[9] && sig[9]<sig[6])
return 143;
if(sig[1]<sig[2] && eqF(sig[2]-sig[4]) && sig[4]<sig[5] && sig[5]<sig[3] && sig[3]<sig[0]
&& sig[10]<sig[7] && sig[7]<sig[8] && sig[8]<sig[6] && sig[6]<sig[11] && sig[11]<sig[9])
return 168;
....
return 0;
}


Quote:
The eqF function in the code above checks if two signals are almost equal, i.e. differ less than FuzzyRange.


And in the Fuzzy Logic chapter (http://www.zorro-trader.com/manual/en/fuzzy.htm):

Quote:
FuzzyRange
Determines the 'fuzziness' range of the input data (default: 0 = no fuzziness). When comparing two variables, the truth value goes from 0 to 1 within that range. Set this to a small fraction of the price volatility, or f.i. to 0.1*PIP for comparing moving averages, or to 0.1 for comparing percentage values. The smaller this value, the 'less fuzzy' is the logic. At the default value 0 the logic is binary. The FuzzyRange variable is also used for classifying signal patterns for price action trading.


Does this mean that, f.i.
Quote:
eqF(sig[2]-sig[4])
is the same that saying
Quote:
0<(sig[2]-sig[4])<1
or am I completely lost? (probably)

In Workshop7, you donīt "set" any FuzzyRange, is there a default FuzzyRange?

Thank you zorro experts.

Re: eqF - FuzzyRange meaning [Re: tomaslolo] #473022
06/09/18 09:11
06/09/18 09:11
Joined: Sep 2003
Posts: 929
Spirit Offline

Moderator
Spirit  Offline

Moderator

Joined: Sep 2003
Posts: 929
it is the same as saying

abs(sig[2]-sig[4]) < FuzzyRange

at least thats what I think.

Re: eqF - FuzzyRange meaning [Re: Spirit] #473052
06/11/18 11:40
06/11/18 11:40
Joined: Feb 2018
Posts: 68
T
tomaslolo Offline OP
Junior Member
tomaslolo  Offline OP
Junior Member
T

Joined: Feb 2018
Posts: 68
Thank you, but how is FuzzyRange calculated?

When running Workshop7.c
Code:
function run()
{
  StartDate = 2005;   // use > 10 years data
  BarPeriod = 1440;   // 1 day
  BarZone = WET;      // West European midnight
  Weekend = 1;        // separate Friday and Sunday bars
  LookBack = 3;       // only 3 bars needed
  NumWFOCycles = 10;   // mandatory for machine learning functions
 
  set(RULES+TESTNOW); // generate rules, test after training
  if(Train) Hedge = 2; // allow long + short
  LifeTime = 5;        // = one week
  MaxLong = MaxShort = 1; // only 1 open trade
 
  if(adviseLong(PATTERN+2,0,
    priceHigh(2),priceLow(2),priceClose(2),
    priceHigh(1),priceLow(1),priceClose(1),
    priceHigh(1),priceLow(1),priceClose(1),
    priceHigh(0),priceLow(0),priceClose(0)) > 40)
    enterLong();
  if(adviseShort() > 40)
    enterShort();
}



You can even have eqF(sig[8]-sig[8]) which should be 0.


Moderated by  Petra 

Powered by UBB.threads™ PHP Forum Software 7.7.1