Renko:update not working as expected

Moderator: admin

Renko:update not working as expected

Postby youdig » Tue Jul 11, 2017 6:09 pm

Hey guys,

I have recently bought a premium strategy from you and I have a bug that I'm unable to fix myself.

Code: Select all
function ExtUpdate(id, source, period)  -- The method called every time when a new bid or ask price appears.
  core.host:trace(string.format("ExtUpdate period: %i", period));
  Renko:update(core.UpdateLast);
-- Check that we have enough data
  if (Renko.DATA:first() > (period - 1)) then
    core.host:trace("Not enough data");
    return
  end

  if (Renko.DATA:size()<10) then
    core.host:trace(string.format("Renko data size too small: %i", Renko.DATA:size()));
    core.host:trace(string.format("EMA(Size: %i)", EMA.DATA:size()));
    return;
  end
  local Rperiod=Renko.DATA:size()-1;
  core.host:trace(string.format("Renko(Size: %i, Rperiod: %i)", Renko.DATA:size(), Rperiod));
  core.host:trace(string.format("Update(Renko open: %f, Renko close: %f)", Renko.open[Rperiod], Renko.close[Rperiod]));
end


The Renko variable is initialized in the
Code: Select all
Prepare()
method like so:
Code: Select all
Renko = core.indicators:create("RENKO_CANDLES", Source, instance.bid:instrument(), instance.parameters.TF, true, instance.parameters.Step, -1000, 0);


But I realized that when a new Renko bar formed, in
Code: Select all
ExtUpdate
the
Code: Select all
trace
method:
Code: Select all
core.host:trace(string.format("Update(Renko open: %f, Renko close: %f)", Renko.open[Rperiod], Renko.close[Rperiod]));
would still show the data of the former Renko bar. The next time
Code: Select all
ExtUpdate
would get called, it'd show the right value.
Isn't this part supposed to get the last renko bar? :
Code: Select all
Renko:update(core.UpdateLast);


Maybe it's doing it asynchronously? Does anyone have a suggestion?

Thanks for your help!
youdig
 
Posts: 4
Joined: Wed Jan 25, 2017 9:23 am

Re: Renko:update not working as expected

Postby Apprentice » Wed Jul 12, 2017 3:26 pm

I have recently bought a premium strategy from you and I have a bug that I'm unable to fix myself.


Who was your contact?
User avatar
Apprentice
FXCodeBase: Confirmed User
 
Posts: 36341
Joined: Thu Dec 31, 2009 11:59 am
Location: Zagreb, Croatia

Re: Renko:update not working as expected

Postby youdig » Wed Jul 12, 2017 5:28 pm

Apprentice wrote:
I have recently bought a premium strategy from you and I have a bug that I'm unable to fix myself.


Who was your contact?

Sergey.Konovalov
youdig
 
Posts: 4
Joined: Wed Jan 25, 2017 9:23 am


Return to Indicator Development

Who is online

Users browsing this forum: No registered users and 8 guests