bugfixy
This commit is contained in:
@ -204,11 +204,21 @@ def next(data, state: StrategyState):
|
||||
#roc_lookback = 20
|
||||
#print(state.vars.MA, "MACKO")
|
||||
#print(state.bars.hlcc4)
|
||||
state.indicators.ema = ema(state.bars.close, state.vars.MA) #state.bars.vwap
|
||||
#trochu prasarna, EMAcko trunc na 3 mista - kdyz se osvedci, tak udelat efektivne
|
||||
state.indicators.ema = [trunc(i,3) for i in state.indicators.ema]
|
||||
#ic(state.vars.MA, state.vars.Trend, state.indicators.ema[-5:])
|
||||
|
||||
#plnime MAcko - nyni posilame jen N poslednich hodnot
|
||||
#zaroven osetrujeme pripady, kdy je malo dat a ukladame nulu
|
||||
try:
|
||||
ma = int(state.vars.MA)
|
||||
source = state.bars.close[-ma:] #state.bars.vwap
|
||||
ema_value = ema(source, ma)
|
||||
state.indicators.ema.append(trunc(ema_value[-1],3))
|
||||
except Exception as e:
|
||||
state.ilog(e="EMA ukladame 0", message=str(e))
|
||||
state.indicators.ema.append(0)
|
||||
|
||||
#TODO helikoz se EMA pocita pro cely set po kazde iteraci znouv, tak je toto PRASARNA
|
||||
#davame pryc jestli bude to vyse fungovat
|
||||
##state.indicators.ema = [trunc(i,3) for i in state.indicators.ema]
|
||||
slope_lookback = int(state.vars.slope_lookback)
|
||||
minimum_slope = float(state.vars.minimum_slope)
|
||||
lookback_offset = int(state.vars.lookback_offset)
|
||||
|
||||
@ -151,13 +151,13 @@ function prepare_data(archRunner, timeframe_amount, timeframe_unit, archivedRunn
|
||||
contentType: "application/json",
|
||||
data: req,
|
||||
success:function(data){
|
||||
console.log("one minute bars before", JSON.stringify(data))
|
||||
//console.log("one minute bars before", JSON.stringify(data))
|
||||
data.map((el)=>{
|
||||
cas = new Date(el.timestamp)
|
||||
el.time = cas.getTime()/1000;
|
||||
delete el.timestamp
|
||||
});
|
||||
console.log("one min bars_after_transformation", JSON.stringify(data))
|
||||
//console.log("one min bars_after_transformation", JSON.stringify(data))
|
||||
oneMinuteBars = data
|
||||
chart_archived_run(archRunner, archivedRunnerDetail, oneMinuteBars);
|
||||
//call function to continue
|
||||
@ -242,6 +242,9 @@ function chart_archived_run(archRecord, data, oneMinuteBars) {
|
||||
last_range = null
|
||||
}
|
||||
|
||||
intitialize_candles()
|
||||
candlestickSeries.setData(AllCandleSeriesesData.get(interval));
|
||||
|
||||
if (interval == native_resolution) {
|
||||
//indicators are in native resolution only
|
||||
display_indicators(data);
|
||||
@ -250,9 +253,6 @@ function chart_archived_run(archRecord, data, oneMinuteBars) {
|
||||
remove_indicators();
|
||||
}
|
||||
|
||||
intitialize_candles()
|
||||
candlestickSeries.setData(AllCandleSeriesesData.get(interval));
|
||||
|
||||
display_buy_markers();
|
||||
|
||||
if (last_range) {
|
||||
@ -289,13 +289,24 @@ function chart_archived_run(archRecord, data, oneMinuteBars) {
|
||||
|
||||
//tranform data do správného formátru
|
||||
items = []
|
||||
//var last = null
|
||||
value.forEach((element, index, array) => {
|
||||
item = {}
|
||||
|
||||
//debug
|
||||
//TOTO odstranit po identifikovani chyby
|
||||
//if (indicators.time[index] !== undefined) {
|
||||
//{console.log("problem",key,last)}
|
||||
item["time"] = indicators.time[index]
|
||||
item["value"] = element
|
||||
//console.log("objekt indicatoru",item)
|
||||
items.push(item)
|
||||
//debug
|
||||
//last = item
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// console.log("chybejici cas", key)
|
||||
// }
|
||||
});
|
||||
|
||||
if (conf.embed) {
|
||||
@ -330,6 +341,8 @@ function chart_archived_run(archRecord, data, oneMinuteBars) {
|
||||
lastValueVisible: false,
|
||||
priceLineVisible: false,
|
||||
});
|
||||
|
||||
//console.log("problem tu",items)
|
||||
//add data
|
||||
obj.series.setData(items)
|
||||
|
||||
|
||||
Binary file not shown.
@ -137,7 +137,7 @@ def is_open_rush(dt: datetime, mins: int = 30):
|
||||
|
||||
def is_close_rush(dt: datetime, mins: int = 30):
|
||||
""""
|
||||
Returns true if time is within morning rush (open+mins)
|
||||
Returns true if time is within afternoon rush (close-mins)
|
||||
"""
|
||||
dt = dt.astimezone(zoneNY)
|
||||
business_hours = {
|
||||
|
||||
Reference in New Issue
Block a user