Gamestudio Links
Zorro Links
Newest Posts
FXCM demo test failed
by qin. 01/13/26 13:53
Camera always moves upwards?
by NeoDumont. 01/12/26 09:39
Alpaca Plugin v1.5.2 Release
by kzhao. 01/11/26 13:42
Alpaca Plugin v1.4.0
by kzhao. 01/11/26 13:38
separating groups of 3 digits by a comma
by joe_kane. 01/11/26 00:01
MRC.c and WFO
by joe_kane. 01/10/26 23:58
BarOffset (default = 940 for daily bars?
by joe_kane. 01/10/26 23:46
AUM Magazine
Latest Screens
Rocker`s Revenge
Stug 3 Stormartillery
Iljuschin 2
Galactic Strike X
Who's Online Now
0 registered members (), 5,207 guests, and 4 spiders.
Key: Admin, Global Mod, Mod
Newest Members
promfast, joe_kane, Namitha_NN, Syndrela, agasior
19190 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Page 2 of 2 1 2
Re: adviseLong(PERCEPTRON produces .c file with syntax error. [Re: GPEngine] #429485
09/13/13 06:30
09/13/13 06:30
Joined: Sep 2013
Posts: 504
California
G
GPEngine Offline OP
User
GPEngine  Offline OP
User
G

Joined: Sep 2013
Posts: 504
California
If no signals are useful, instead of emitting an error message, Zorro should generate a rules .c file with EURUSD_L and EURUSD_S which always return a constant less than 0, meaning no trade is ever advised. I don't understand the need for an error message here. The advise functions already have an approach for handling useless inputs -- they discard them, and the user can open the resulting .c file and see that some inputs played no role. Why should something special happen if all the inputs are useless instead of just some?

A potentially larger question here is why does the lite-C compiler reject this line of code? (mentioned earlier)
Code:
if(+0.04*sig[1] > 0.50)


Is this not allowed in the lite-C grammar? It's valid C. There is no specific lite-C grammar, (http://www.opserver.de/ubb7/ubbthreads.php?ubb=showflat&Number=417318)

For this reason I think I have uncovered a lite-C compiler bug.

Here's another example.
Code:
function run() {
  NumYears = 1;
  AssetList = "AssetsUS.dta";
  LookBack = 900;
  BarPeriod = 1;
  set(RULES+TESTNOW);
  if (Train) {
    set(HEDGING);
    reset(NFA);
    ExitTime = 20;
    NumWFOCycles = 5;
  } else {
    reset(HEDGING);
    set(NFA);
    Stop = 25*PIP;
    TakeProfit = 25*PIP;
  }

  var v00 = CDLMatHold(15);
  var v01 = CDLTristar();
  var v02 = CDLHangingMan();
  var v03 = genSine(109);
  var v04 = AroonOsc(30);
  var v05 = priceLow(0);
  var v06 = CDL3BlackCrows();

  if(adviseLong(PERCEPTRON, 0, v00, v01, v02, v03, v04, v05, v06) > 0) {
    enterLong();
  }
  if(adviseShort() > 0) {
    enterShort();
  }
}


This produces a rules file a_EURUSD.c like
Code:
// Prediction rules generated by Zorro

int EURUSD_L(float* sig)
{
  if(+58.32*sig[3]-91.04*sig[4]-65.42*sig[5] > 44.50)
    return 45;
  else
    return -45;
}

int EURUSD_S(float* sig)
{
  if(+186.00*sig[3]+84.33*sig[4]-115.11*sig[5] > 155.50)
    return 49;
  else
    return -49;
}

// Prediction accuracy: 47%


which Zorro chokes on for syntax error
Code:
Error in 'line 5: 
syntax error
<   if(+58.32*sig[3]-91.04*sig[4]-65.42*sig[5] > 44.50) >


.... but why? This line is fine. If I take out the + signs at the beginning, Zorro can Test the strategy.

lite-c compiler bug laugh

Re: adviseLong(PERCEPTRON produces .c file with syntax error. [Re: GPEngine] #429487
09/13/13 09:19
09/13/13 09:19
Joined: Jul 2000
Posts: 28,051
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 28,051
Frankfurt
The code is rejected because "+" is an operator that requires two operands. When one is missing, the compiler issues an error. This is different for "-", which works with one or two operands.

The problem happens when signals are not a signal, but a constant, and thus get zero weight in the perceptron algo. They are then eliminated from the perceptron formula. This led to the syntax errors.

As the elimination of signals was eliminated for the next update, such problems won't occur anymore. The signal will then still be useless for the perceptron, but won't cause syntax errors.

Re: adviseLong(PERCEPTRON produces .c file with syntax error. [Re: jcl] #429515
09/13/13 14:37
09/13/13 14:37
Joined: Sep 2013
Posts: 504
California
G
GPEngine Offline OP
User
GPEngine  Offline OP
User
G

Joined: Sep 2013
Posts: 504
California
Thanks for the explanation. laugh Good solution.

In ANSI C, + can be a binary or a unary operator, like -.

Page 2 of 2 1 2

Moderated by  Petra 

Gamestudio download | 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