is(INITRUN) not in TRAINMODE?

Posted By: Grat

is(INITRUN) not in TRAINMODE? - 06/06/19 21:22

Hi,

I have this test code:
Code:
function run(){
  Verbose    = 7;
  StartDate  = 20190210; 
  EndDate    = 2019;
  LookBack   = 100;
  NumYears   = 1;
  BarPeriod  = 15;
  asset("EUR/USD");

  if (is(INITRUN)){

      if (is(TRAINMODE))
        printf("n--- Train MODE----");
      
      if (is(TESTMODE))
        printf("n--- Test MODE1----");
      printf("nAfter init------------------");
  }
}



with output:

test compiling...........
8497 Bars 2019-01-30..2019-06-06 generated
Train: test 2019

my question is, in the Train I cannot use INITRUN?

thanks Milan

edit: is(FIRSTRUN) is the same
Posted By: AndrewAMD

Re: is(INITRUN) not in TRAINMODE? - 06/06/19 22:10

The manual is your friend! laugh

Originally Posted By: Grat
my question is, in the Train I cannot use INITRUN?
INITRUN is used in Train. But printf() is disabled in Train mode. Use print() with flags instead. Read about it here:
https://zorro-project.com/manual/en/printf.htm

Quote:
edit: is(FIRSTRUN) is the same
No. Read about it here:
https://zorro-project.com/manual/en/is.htm
Posted By: Grat

Re: is(INITRUN) not in TRAINMODE? - 06/07/19 12:23

so,

I trying this:
Code:
NumTrainCycles = 2;
	if(TrainCycle == 1) set(RULES);
	else if(TrainCycle == 2) set(PARAMETERS);
 	else if(TrainCycle == 0) set(RULES|PARAMETERS); ¨



after first cycle Train finish. I cannot found, where I have bug. Any Idea?

but every time run only 1 cycle.
Quote:

Bar 1849: 0 - bar 1850: 2

ai_dtree_opt compiling..................
4230 Bars 2019-03-27..2019-05-29 generated
Warning 047: USD/JPY first bar at 2019-03-27
Parse PredikceUSDJPY-5-white.csv.. 15380 records
Parse PredikceUSDJPY-15-white.csv.. 5254 records
Rules: ai_dtree_opt 2019
Assets HistoryAssetsGP.csv
Error 015: invalid advise signal[4] at bar 118
Train USDJPY_L => ai_dtree_opt_USDJPY_L.csv
Train USDJPY_S => ai_dtree_opt_USDJPY_S.csv




Description: show
Attached picture Screenshot_87.png
Posted By: Grat

Re: is(INITRUN) not in TRAINMODE? - 06/08/19 11:39

So,

for the better illustration I use the WORKSHOP_7

Code:
// Machine learning ////////////////////////////
#include <profile.c>

function run()
{
	StartDate = 2010;
	EndDate = 2018;
	BarPeriod = 1440; // 1 day
	BarZone = WET; // Western European midnight
	Weekend = 1;	// don't merge Friday and Sunday bars
//	NumWFOCycles = 5;
	asset("EUR/USD");
	
	//set(RULES+TESTNOW);
	NumTrainCycles = 2;
	if(TrainCycle == 1) set(RULES);
	else if(TrainCycle == 2) set(PARAMETERS);
  	else if(TrainCycle == 0) set(RULES|PARAMETERS|FACTORS); 

	if(Train) Hedge = 2;	// for training, allow long + short	
	LifeTime = 3;  		// one week
	MaxLong = MaxShort = -1;

>>>	int nTr=optimize(50,10,100); <<< NO work?

	if(adviseLong(PATTERN+FAST+2+RETURNS,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)) > nTr)
		enterLong();
	
	if(adviseShort() > nTr)
		enterShort();

	PlotWidth = 600;
	PlotHeight1 = 300;
	//plotTradeProfile(40);
	//plotWFOCycle(Equity,0);
	//plotWFOProfit();
}



Train output:


Workshop7 compiling...............
Rules: Workshop7 2010..2018
Train EURUSD_L 37 patterns
Train EURUSD_S 52 patterns
Rules stored in Workshop7.c

Question is, why not had start the training cycle two

Posted By: Grat

Re: is(INITRUN) not in TRAINMODE? - 06/09/19 09:57

I change from printf to watch.
Quote:
Displays the given text and up to 8 following bool, int, var, float, or string variables in the message window, or prints them to the log or diag.txt file in all modes. Optionally stops execution and changes to single step mode. Allows to quickly debug into functions and watch variable behavior.



Code:
// Machine learning ////////////////////////////
#include <profile.c>

function run()
{
	StartDate = 2010;
	EndDate = 2018;
	BarPeriod = 1440; // 1 day
	BarZone = WET; // Western European midnight
	Weekend = 1;	// don't merge Friday and Sunday bars
	asset("EUR/USD");
	
	NumTrainCycles = 2;
	if(TrainCycle == 1) set(RULES);
	else if(TrainCycle == 2) set(PARAMETERS);
  	else if(TrainCycle == 0) set(RULES|PARAMETERS); 

	if(Train) Hedge = 2;	// for training, allow long + short	
	LifeTime = 3;  		// one week
	MaxLong = MaxShort = -1;
	int nTr=optimize(50,0,100);
        Stop = optimize(1,1,50);

	if(adviseLong(PATTERN+FAST+2+RETURNS,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)) > nTr)
		enterLong();
	
	if(adviseShort() > nTr)
		enterShort();

  if (is(EXITRUN)){
    if (TrainCycle == 2)
      watch("nExit Cycle 2------------------");
    if (TrainCycle == 1)
      watch("nExit Cycle 1------------------");
    if (TrainCycle == 0)
      watch("nExit Cycle 0------------------");
  }

  if (is(FIRSTRUN)){
    if (TrainCycle == 2)
      watch("n----- Cycle 2------------------");
    if (TrainCycle == 1)
      watch("n----- Cycle 1------------------");
    if (TrainCycle == 0)
      watch("n----- Cycle 0------------------");
  }

}



and output is:


test compiling................
Rules: test 2010..2018

----- Cycle 1------------------

Exit Cycle 1------------------
Train EURUSD_L 37 patterns
Rules stored in test.c

No cycle 2???
Posted By: Spirit

Re: is(INITRUN) not in TRAINMODE? - 06/10/19 10:15

Maybe you should contact the support, I see nothing wrong in your code.
Posted By: Grat

Re: is(INITRUN) not in TRAINMODE? - 06/12/19 20:50

Is a problem with version 2.12. With 1.96 working without problem.
Posted By: jcl

Re: is(INITRUN) not in TRAINMODE? - 06/13/19 08:14

Try the latest beta version. I see no issue with multiple training cycles on the bug list, but if it was related to 2.12, it should work with the beta. The training system was modified in that version.
Posted By: Grat

Re: is(INITRUN) not in TRAINMODE? - 06/13/19 19:27

With the beta also work. Only with 2.12 is a problem
Posted By: laz

Re: is(INITRUN) not in TRAINMODE? - 06/13/19 21:00

Hi guys, i faced the same problem, TrainCycle is never 2 with 2.12.

Where can i find the beta?
Posted By: AndrewAMD

Re: is(INITRUN) not in TRAINMODE? - 06/13/19 23:23

Originally Posted by laz
Where can i find the beta?

In the download section.
Posted By: laz

Re: is(INITRUN) not in TRAINMODE? - 06/14/19 13:15

oh yes, now I've seen it, thanks;)
© 2024 lite-C Forums