Closed costargc closed 5 years ago
I’ve noticed that sometime the 10minPriceVariation will return 0 sometimes. Maybe this could be part of the issue?
I’ve noticed that sometime the 10minPriceVariation will return 0 sometimes. Maybe this could be part of the issue?
this would only be an issue if all the values we capture are zero. If that is the case, BuyIf and SellIf should indeed be zero. But if that is happening its an error, its almost impossible for the market to behave like that. And Bitcoin is also quite volatile - so its not going to keep giving zero var every 5min.
also... error seems to be centralized in the sell side. Its easy to check... if ( console.log(SellSignal) > 0 && console.log(BuySignal) < 0) they are in the wrong position... if this it it, Its easy to solve. If its not, I would need to investigate.
One way is to print y0.sort() and see if data is good.
this is not an issue... what needs to be done here is to include a std break approach.
i.e. calculate moving average (ma
) using as ref a number like 120min (24 ticks - 5min each) and calculate the standard deviation (std
). The band would be:
up_limit = ma + k*std
lower_limit = ma - k*std
where k
is a value that we need to calibrate - for start we can use k=2 (that accounts for 95.4% of the data)
just implemented an initial fix... that would need to change if we increase the timeframe ex.: from 10min to 60min.
// TODO: a better way to find out the Buy and Sell predict line would be to look
// at the market depth order book and see large BTC walls in there.
// for now, this hardcode above combining Buy and Sell signal and limiting it to at least +/- 0.01/3 is fine...
BuySignalPredict = Math.max(BuySignal, Math.abs(SellSignal), 0.01 / 3);
SellSignalPredict = Math.min(SellSignal, -Math.abs(BuySignal), -0.01 / 3);
This should not be possible... Buy and sell if prices are calculated based on the signals that comes from the tenMinPriceVariation. i.e. tenMinPriceVariation for SellSignal consideres the third lower percentile break line where the BuySignal conisderes the first top percentile. If I order the tenMinVariation >> SellSignal is the [length/3] element where the BuySignal is the [length - length/3] element.
"Buy";
PredictResults["SellIfPrice"] = CurrentPrice * (1 + BuySignal);
PredictResults["BuyIfPrice"] = CurrentPrice;
"Hold";
PredictResults["SellIfPrice"] = CurrentPrice * (1 + BuySignal);
PredictResults["BuyIfPrice"] = CurrentPrice * (1 + SellSignal);
"Sell";
PredictResults["SellIfPrice"] = CurrentPrice;
PredictResults["BuyIfPrice"] = CurrentPrice * (1 + SellSignal);
where:SellSignal = y0.sort()[Math.floor(y0.length / 3)];
BuySignal = y0.sort()[y0.length - Math.floor(y0.length / 3)];
and
y0.push(entry[0].tenMinPriceVariation);