Gamestudio Links
Zorro Links
Newest Posts
Help!
by VoroneTZ. 10/14/25 05:04
Zorro 2.70
by jcl. 10/13/25 09:01
ZorroGPT
by TipmyPip. 10/12/25 13:58
Sam Foster Sound | Experienced Game Composer for Hire
by titanicpiano14. 10/11/25 18:45
Reality Check results on my strategy
by dBc. 10/11/25 06:15
optimize global parameters SOLVED
by dBc. 09/27/25 17:07
AUM Magazine
Latest Screens
Rocker`s Revenge
Stug 3 Stormartillery
Iljuschin 2
Galactic Strike X
Who's Online Now
2 registered members (VoroneTZ, TipmyPip), 9,297 guests, and 1 spider.
Key: Admin, Global Mod, Mod
Newest Members
Jota, krishna, DrissB, James168, Ed_Love
19169 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Daily entry #484395
10/21/21 14:40
10/21/21 14:40
Joined: Sep 2021
Posts: 2
Bogotá
Avedon Offline OP
Guest
Avedon  Offline OP
Guest

Joined: Sep 2021
Posts: 2
Bogotá
Hi everyone,
I found these trading rules in a trading forum and I'm trying to translate them into Lite-C:

1. Set up your chart with any asset, 5 minute chart, starting at 9:30 AM Exchange time, and ending
at 3:15 PM.
2. Record the open of the first bar of the day, and refer to it as “openp”
3. At the close of the second bar of the day (at 9:40 AM) go long if:
A. The low of bar 2 is greater than openp
B. The 5 bar RSI indicator is below 50 OR both the close if greater than previous bar close AND
the close if greater than close 2 bars ago AND the daily close is less than the daily close 2 bars ago
4. At the close of the second bar of the day (at 9:40 AM) go short if:
A. The high of bar 2 is less than openp
B. The 5 bar RSI indicator is above 50 OR both the close if less than previous bar close AND the
close if less than close 2 bars ago AND the daily close is greater than the daily close 2 bars ago
5. If you are in a short trade, and the time is after than 11:00 AM and the position is profitable, exit at
the open of the next bar.

6. To add a volatility filter:
A. If the true range of the daily bar is greater than the average true range of the last 5 daily
bars, then:
1. No new trades can be entered
2. Any existing trades should be closed out
B. If the true range condition is not met, then trading should proceed as usual.

This is the Work-in-Progress Code:

Code
function run()
{
     
  
  StartDate = 2010; 
  EndDate = 2020;   
  BarPeriod = 5;	
  LookBack = 1000;	
  var Openp = priceOpen(2);
  var Close = priceClose();
  var Day0 =  dayClose(ET,0);
  var Day2 =  dayClose(ET,2);
  vars Closes = series(priceClose());
  asset("EUR/USD");
		
  
    if(timeOffset(ET,0,9,40) == 0) // enter a trade at second bar
  {    
    if(priceLow() > Openp
      && RSI(Closes,5) < 50
      || (priceClose() > priceClose(1) && priceClose() > priceClose(2) && Day0 < Day2))
      enterLong();
     
    if(priceHigh() < Openp
      && RSI(Closes,5) > 50
      || (priceClose() < priceClose(1) && priceClose() < priceClose(2) && Day0 > Day2))
      enterShort();
  }
}



I got this Error:

Error 045: Negative price offset at bar 11 and Zorro continues to train the algorithm indefinitely.
Nor do I understand how to execute numeral 6 "To add a volatility filter" in a trade that is already open.
I have tried to solve it and I have not been able, could you help me to solve it please?

Re: Daily entry [Re: Avedon] #484397
10/21/21 15:43
10/21/21 15:43
Joined: Apr 2008
Posts: 594
Austria
Petra Offline
Support
Petra  Offline
Support

Joined: Apr 2008
Posts: 594
Austria
Check the dayclose call. If called before market close, you're requesting a price from the future.

Re: Daily entry [Re: Avedon] #484403
10/22/21 19:02
10/22/21 19:02
Joined: Sep 2021
Posts: 2
Bogotá
Avedon Offline OP
Guest
Avedon  Offline OP
Guest

Joined: Sep 2021
Posts: 2
Bogotá
Now it is working, but in the test entry time is 13:40, not 9:40, I could just subtract 4 hours from it, but I would like it to work from the code, any suggestion or reason why this happens?

Re: Daily entry [Re: Avedon] #484408
10/23/21 05:02
10/23/21 05:02
Joined: Aug 2017
Posts: 311
Netherlands
G
Grant Offline
Senior Member
Grant  Offline
Senior Member
G

Joined: Aug 2017
Posts: 311
Netherlands
You prob need to choose a different zone for the timeOffset() function.

Last edited by Grant; 10/23/21 05:03.

Moderated by  Petra 

Powered by UBB.threads™ PHP Forum Software 7.7.1