|
3 registered members (TipmyPip, Quad, 1 invisible),
8,540
guests, and 8
spiders. |
|
Key:
Admin,
Global Mod,
Mod
|
|
|
|
32 minutes ago
Z12+ and Z6+ use the evaluation shell, but in DEPLOY mode, with no panel and immedate start.
3
38
Read More
|
|
|
11 hours ago
thanks. whats the difference from Zorro built in fxcm plugin
3
1,477
Read More
|
|
02/05/26 14:20
A new IB plugin was uploaded for beta testing: https://opserver.de/down/IB.zipThis plugin addresses the problem that the IB TWS and Gateway go down once per day, which leaves their API in an invalid state. The plugin supports a new broker command for releasing and restarting the API at a certain time. Call brokerCommand(75,2205) for reconnecting at or after 22:05.
0
160
Read More
|
|
02/05/26 11:14
// ------------------- DTREE ensemble term ------------------
var dtreeTerm(int i, int* outTopEq, var* outTopW){
int j;
int tid_i = dt.safeTreeIndexFromEq((int)net.EqTreeId[i], dt.TreeN);
Node* ti = dt.treeAt(tid_i);
int di = ti->d; var ri=ti->r;
var predI = dt.predByTid(tid_i);
var alpha = (var)net.TAlpha[i];
var beta = (var)net.TBeta[i];
var sumw=0, acc=0, bestW=-1; int bestJ=-1;
for(j=0;j<net.N;j++){
if(j==i) continue;
int tid_j = dt.safeTreeIndexFromEq((int)net.EqTreeId[j], dt.TreeN);
Node* tj=dt.treeAt(tid_j);
int dj=tj->d; var rj=tj->r;
var predJ = dt.predByTid(tid_j);
var w = exp(-alpha*abs(di-dj)) * exp(-beta*abs(ri-rj));
var predBoost = 0.5 + 0.5*(predI*predJ);
var propBoost = 0.5 + 0.5*( (net.Prop[i] + net.Prop[j]) );
w *= predBoost * propBoost;
var pairAdv = scorePairSafe(i,j,0,0,0,0);
var pairBoost = 0.75 + 0.25*(0.5*(pairAdv+1.0));
w *= pairBoost;
sumw += w;
acc += w*net.State[j];
if(w>bestW){ bestW=w; bestJ=j; }
}
if(outTopEq) *outTopEq = bestJ;
if(outTopW) *outTopW = ifelse(sumw>0, bestW/sumw, 0);
if(sumw>0) return acc/sumw;
return 0;
}
// ------------------- expression builder (optional) --------------------
void buildSymbolicExpr(int i, int n1, int n2){
if(!LOG_EXPR_TEXT) return;
if(!net.Sym) return;
string s = net.Sym[i];
s[0]=0;
string a1 = strf("(%.3f*x[%i] + %.3f*lam + %.3f*mean + %.5f*E + %.3f*P + %.3f*i + %.3f)",
(var)net.A1x[i], n1, (var)net.A1lam[i], (var)net.A1mean[i], (var)net.A1E[i], (var)net.A1P[i], (var)net.A1i[i], (var)net.A1c[i]);
string a2 = strf("(%.3f*x[%i] + %.3f*lam + %.3f*mean + %.5f*E + %.3f*P + %.3f*i + %.3f)",
(var)net.A2x[i], n2, (var)net.A2lam[i], (var)net.A2mean[i], (var)net.A2E[i], (var)net.A2P[i], (var)net.A2i[i], (var)net.A2c[i]);
Alpha12Logger::strlcat_safe(s, "x[i]_next = ", EXPR_MAXLEN);
Alpha12Logger::strlcat_safe(s, strf("%.3f*x[i] + ", (var)net.WSelf[i]), EXPR_MAXLEN);
if(net.Mode[i]==1){
Alpha12Logger::strlcat_safe(s, strf("%.3f*tanh%s + ", (var)net.WN1[i], a1), EXPR_MAXLEN);
Alpha12Logger::strlcat_safe(s, strf("%.3f*sin%s + ", (var)net.WN2[i], a2), EXPR_MAXLEN);
} else if(net.Mode[i]==2){
Alpha12Logger::strlcat_safe(s, strf("%.3f*cos%s + ", (var)net.WN1[i], a1), EXPR_MAXLEN);
Alpha12Logger::strlcat_safe(s, strf("%.3f*tanh%s + ", (var)net.WN2[i], a2), EXPR_MAXLEN);
} else {
Alpha12Logger::strlcat_safe(s, strf("%.3f*sin%s + ", (var)net.WN1[i], a1), EXPR_MAXLEN);
Alpha12Logger::strlcat_safe(s, strf("%.3f*cos%s + ", (var)net.WN2[i], a2), EXPR_MAXLEN);
}
Alpha12Logger::strlcat_safe(s, strf("%.3f*tanh(%.3f*mean + %.5f*E) + ",
(var)net.WGlob1[i], (var)net.G1mean[i], (var)net.G1E[i]), EXPR_MAXLEN);
Alpha12Logger::strlcat_safe(s, strf("%.3f*sin(%.3f*P + %.3f*lam) + ",
(var)net.WGlob2[i], (var)net.G2P[i], (var)net.G2lam[i]), EXPR_MAXLEN);
Alpha12Logger::strlcat_safe(s, strf("%.3f*(x[i]-x_prev[i]) + ", (var)net.WMom[i]), EXPR_MAXLEN);
Alpha12Logger::strlcat_safe(s, strf("Prop[i]=%.4f; ", (var)net.Prop[i]), EXPR_MAXLEN);
Alpha12Logger::strlcat_safe(s, strf("%.3f*DT(i) + ", (var)net.WTree[i]), EXPR_MAXLEN);
Alpha12Logger::strlcat_safe(s, strf("%.3f*DTREE(i)", (var)net.WAdv[i]), EXPR_MAXLEN);
}
void buildSymbolicExpr_range(int i0,int i1){
if(!LOG_EXPR_TEXT) return;
if(i0<0) i0=0; if(i1>net.N) i1=net.N;
int i;
for(i=i0;i<i1;i++){
int n1 = net.adjSafe(i,0);
int n2 = ifelse(net.D>=2, net.adjSafe(i,1), n1);
buildSymbolicExpr(i,n1,n2);
}
}
// ------------------- chunked rewire orchestrator ----------------------
int rewireEpochChunk(var lambda, var mean, var energy, var power, int batch){
if(net.N <= 0) return 0;
if(batch < REWIRE_MIN_BATCH) batch = REWIRE_MIN_BATCH;
if(RewirePos >= net.N) RewirePos = 0;
int i0 = RewirePos;
int i1 = i0 + batch; if(i1 > net.N) i1 = net.N;
CandNeigh = ifelse(MH.Entropy < 0.45, CAND_NEIGH+4, CAND_NEIGH);
rewireAdjacency_DTREE_range(i0,i1, lambda,mean,energy,power);
net.sanitizeAdjacency();
synthesizeEquation_range(i0,i1, lambda,mean,energy,power);
buildSymbolicExpr_range(i0,i1);
RewirePos = i1;
if(RewirePos >= net.N){
RewirePos = 0;
RewirePasses++;
return 1;
}
return 0;
}
void rewireEpoch(var lambda, var mean, var energy, var power){
int done=0;
while(!done){
done = rewireEpochChunk(lambda,mean,energy,power, REWIRE_BATCH_EQ_H1);
}
net.normalizeProportions();
{
int D = net.D, i, total = net.N*D;
unsigned int h = 2166136261u;
for(i=0;i<total;i++){
unsigned int x = (unsigned int)net.Adj[i];
h ^= x + 0x9e3779b9u + (h<<6) + (h>>2);
}
CtxID = (int)((h ^ ((unsigned int)Epoch<<8)) & 0x7fffffff);
}
}
// ------------------- coarse net projection -> gamma -------------------
var projectNet(){
int i;
var sum=0,sumsq=0,cross=0;
for(i=0;i<net.N;i++){
sum += net.State[i];
sumsq += net.State[i]*net.State[i];
if(i+1<net.N) cross += net.State[i]*net.State[i+1];
}
var mean = sum/net.N;
var corr = cross/(net.N-1);
return 0.6*tanh(mean + 0.001*sumsq) + 0.4*sin(corr);
}
// ------------------- heavy update chunk (OpenCL-batched) --------------
var nonlin1(int i, int n1, var lam, var mean, var E, var P){
var x = net.State[n1];
var arg = (var)net.A1x[i]*x + (var)net.A1lam[i]*lam + (var)net.A1mean[i]*mean + (var)net.A1E[i]*E + (var)net.A1P[i]*P + (var)net.A1i[i]*i + (var)net.A1c[i];
return arg;
}
var nonlin2(int i, int n2, var lam, var mean, var E, var P){
var x = net.State[n2];
var arg = (var)net.A2x[i]*x + (var)net.A2lam[i]*lam + (var)net.A2mean[i]*mean + (var)net.A2E[i]*E + (var)net.A2P[i]*P + (var)net.A2i[i]*i + (var)net.A2c[i];
return arg;
}
int heavyUpdateChunk(var lambda, var mean, var energy, var power, int batch){
if(net.N <= 0) return 0;
if(batch < UPDATE_MIN_BATCH) batch = UPDATE_MIN_BATCH;
if(UpdatePos >= net.N) UpdatePos = 0;
int i0 = UpdatePos;
int i1 = i0 + batch; if(i1 > net.N) i1 = net.N;
net.computeProjection();
if(OclReady) {
computeAdviceBatchRange(i0, i1, lambda, mean, energy, power);
} else {
resetAdvCacheForBar();
}
for(int i=i0;i<i1;i++){
int n1 = net.adjSafe(i,0);
int n2 = ifelse(net.D>=2, net.adjSafe(i,1), n1);
int topEq=-1; var topW=0;
var treeT = dtreeTerm(i, &topEq, &topW);
net.TreeTerm[i] = (fvar)treeT;
net.TopEq[i] = (i16)topEq;
net.TopW[i] = (fvar)topW;
var adv = adviseEq(i, lambda, mean, energy, power);
var a1 = nonlin1(i,n1,lambda,mean,energy,power);
var a2 = nonlin2(i,n2,lambda,mean,energy,power);
var t1,t2;
if(net.Mode[i]==1){ t1=tanh(a1); t2=sin(a2); }
else if(net.Mode[i]==2){ t1=cos(a1); t2=tanh(a2); }
else { t1=sin(a1); t2=cos(a2); }
var glob1 = tanh((var)net.G1mean[i]*mean + (var)net.G1E[i]*energy);
var glob2 = sin ((var)net.G2P[i]*power + (var)net.G2lam[i]*lambda);
var mom = (net.State[i] - net.Prev[i]);
var xnext =
(var)net.WSelf[i]*net.State[i]
+ (var)net.WN1[i]*t1
+ (var)net.WN2[i]*t2
+ (var)net.WGlob1[i]*glob1
+ (var)net.WGlob2[i]*glob2
+ (var)net.WMom[i]*mom
+ (var)net.WTree[i]*treeT
+ (var)net.WAdv[i]*adv;
xnext = clamp(xnext, -10., 10.);
net.Prev[i] = net.State[i];
net.State[i] = xnext;
net.StateSq[i] = xnext*xnext;
net.AdvPrev[i] = (fvar)adv;
if(!rt.LogsOff && (Bar % LOG_EVERY)==0 && (i < LOG_EQ_SAMPLE)){
int tid = dt.safeTreeIndexFromEq((int)net.EqTreeId[i], dt.TreeN);
Node* tnode = dt.treeAt(tid);
int nodeDepth = (tnode ? tnode->d : 0);
var rate = (var)net.TBeta[i];
var pred = dt.predByTid(tid);
string expr = 0;
if(LOG_EXPR_TEXT && net.Sym) expr = net.Sym[i];
log.appendEqMetaLine(Bar, Epoch, CtxID,
i, n1, n2, tid, nodeDepth, rate, pred, adv, net.Prop[i], (int)net.Mode[i],
(var)net.WAdv[i], (var)net.WTree[i], MH.PBullNext, MH.Entropy, (int)MH.Cur,
expr);
}
}
UpdatePos = i1;
if(UpdatePos >= net.N){
UpdatePos = 0;
UpdatePasses++;
return 1;
}
return 0;
}
// ------------------- hit-rate scorer ----------------------
void updateHitRates(){
if(is(INITRUN)) return;
if(Bar <= LookBack) return;
var r = net.Ret1;
var sgnR = sign(r);
for(int i=0;i<net.N;i++){
var a = (var)net.AdvPrev[i];
var sgnA = ifelse(a > 0.0001, 1, ifelse(a < -0.0001, -1, 0));
var hit = ifelse(sgnR == 0, 0.5, ifelse(sgnA == sgnR, 1.0, 0.0));
net.HitEW[i] = (fvar)((1.0 - 0.02)*(var)net.HitEW[i] + 0.02*hit);
net.HitN[i] += 1;
}
}
// ------------------- blend lambda/gamma & accuracy --------------------
var blendLambdaGamma(var lambda_raw, var gamma_raw){
var w = clamp(FB_W + 0.15*(0.5 - MH.Entropy), 0.4, 0.9);
var x = w*lambda_raw + (1.0 - w)*gamma_raw;
rt.acc_update(lambda_raw, gamma_raw);
return x;
}
// ------------------- rewire scheduler ----------------
void maybeRewireNow(var lambda, var mean, var energy, var power){
int mb = mem_mb_est();
if(mb >= UPDATE_MEM_HARD) return;
int batch = ifelse(is_H1_close(), REWIRE_BATCH_EQ_H1, REWIRE_BATCH_EQ_5M);
if(mb >= REWIRE_MEM_SOFT) batch = (batch>>1);
if(batch < REWIRE_MIN_BATCH) batch = REWIRE_MIN_BATCH;
int finished = rewireEpochChunk(lambda,mean,energy,power,batch);
if(finished && (RewirePasses % REWIRE_NORM_EVERY) == 0){
net.normalizeProportions();
log.writeEqHeaderOnce();
if((RewirePasses % META_EVERY) == 0){
int D = net.D, i, total = net.N*D;
unsigned int h = 2166136261u;
for(i=0;i<total;i++){
unsigned int x = (unsigned int)net.Adj[i];
h ^= x + 0x9e3779b9u + (h<<6) + (h>>2);
}
CtxID = (int)((h ^ ((unsigned int)Epoch<<8)) & 0x7fffffff);
}
}
}
// ------------------- heavy update scheduler ----------------
void runHeavyUpdates(var lambda, var mean, var energy, var power){
int mb = mem_mb_est();
if(mb >= UPDATE_MEM_HARD) return;
int batch = ifelse(is_H1_close(), UPDATE_BATCH_EQ_H1, UPDATE_BATCH_EQ_5M);
if(mb >= UPDATE_MEM_SOFT) batch = (batch>>1);
if(batch < UPDATE_MIN_BATCH) batch = UPDATE_MIN_BATCH;
heavyUpdateChunk(lambda,mean,energy,power,batch);
}
// ------------------- main engine step ---------------------
void alpha12_step(var ret1_now){
if(!ready) return;
updateAllMarkov();
if(Bar < LookBack){
net.computeProjection();
net.Ret1 = ret1_now;
var h=0;
for(int i=0;i<net.N;i++) h += (var)net.HitEW[i];
if(net.N > 0) h /= (var)net.N; else h=0.5;
var target = MC_ACT + 0.15*(0.55 - h) + 0.10*(MH.Entropy - 0.5);
target = clamp(target, 0.20, 0.50);
MC_ACT_dyn = 0.95*MC_ACT_dyn + 0.05*target;
return;
}
net.computeProjection();
int Keff = net.keffClamped();
var e=0, pwr=0;
for(int k=0;k<Keff;k++){ var z=(var)net.Z[k]; e+=z; pwr+=z*z; }
var mean=0, power=0;
if(Keff > 0){ mean = e/(var)Keff; power = pwr/(var)Keff; }
var energy = pwr;
var lambda = 0.7*tanh(mean) + 0.3*tanh(0.05*power);
maybeRewireNow(lambda,mean,energy,power);
runHeavyUpdates(lambda,mean,energy,power);
var gamma = projectNet();
var x = blendLambdaGamma(lambda,gamma);
(void)x;
dt.updateEquationCycle(net.Prop, net.N);
net.Ret1 = ret1_now;
updateHitRates();
int beforeDepth = rt.RT_TreeMaxDepth;
rt.depth_manager_runtime(dt);
if(rt.RT_TreeMaxDepth != beforeDepth){
reindexTreeAndMap();
}
{
var h=0;
for(int i=0;i<net.N;i++) h += (var)net.HitEW[i];
if(net.N > 0) h /= (var)net.N; else h=0.5;
var target = MC_ACT + 0.15*(0.55 - h) + 0.10*(MH.Entropy - 0.5);
target = clamp(target, 0.20, 0.50);
MC_ACT_dyn = 0.9*MC_ACT_dyn + 0.1*target;
}
}
// ------------------- realized 1-bar return ----------------
var realizedRet1(){
vars C = series(priceClose(0));
if(Bar <= LookBack) return 0;
return C[0] - C[1];
}
// ------------------- trading signal -----------------------
var tradeSignal(){
if(!ready) return 0;
if(!net.RP || !net.Z || !net.StateSq) return 0;
net.computeProjection();
int Keff = net.keffClamped();
if(Keff <= 0) return 0;
var e=0, pwr=0;
for(int k=0;k<Keff;k++){ var z=(var)net.Z[k]; e+=z; pwr+=z*z; }
var mean=0, power=0;
if(Keff > 0){ mean = e/(var)Keff; power = pwr/(var)Keff; }
var lambda = 0.7*tanh(mean) + 0.3*tanh(0.05*power);
var gamma = projectNet();
var x = blendLambdaGamma(lambda,gamma);
LastSig = x;
var gLong=0, gShort=0;
if(MH.PBullNext >= PBULL_LONG_TH) gLong = 1.0;
if(MH.PBullNext <= PBULL_SHORT_TH) gShort= 1.0;
var s=0;
if(x > 0) s = x*gLong;
else s = x*gShort;
var conf = 1.0 - 0.5*(MR.Entropy);
s *= conf;
return clamp(s,-1.,1.);
}
// ------------------- position sizing & orders -------------
var posSizeFromSignal(var s){
var base = 1;
var scale = 2.0*abs(s);
return base * (0.5 + 0.5*scale);
}
void placeOrders(var s){
if(s > 0){
if(NumOpenShort) exitShort();
if(!NumOpenLong){
Lots = posSizeFromSignal(s);
enterLong();
}
} else if(s < 0){
if(NumOpenLong) exitLong();
if(!NumOpenShort){
Lots = posSizeFromSignal(s);
enterShort();
}
}
}
void plotSafe(string name, var v){
if(ENABLE_PLOTS && !rt.ChartsOff) plot(name, v, NEW|LINE, 0);
}
void onBar(){
var r1 = realizedRet1();
alpha12_step(r1);
var s = tradeSignal();
placeOrders(s);
plotSafe("PBull(1H)", 100*(MH.PBullNext-0.5));
plotSafe("PBull(5M)", 100*(ML.PBullNext-0.5));
plotSafe("PBull(Rel)", 100*(MR.PBullNext-0.5));
plotSafe("Entropy(1H)", 100*(MH.Entropy));
plotSafe("Sig", 100*LastSig);
}
// ----------------------- init/cleanup ----------------------
void init() {
if(ready) return;
BarPeriod = BAR_PERIOD;
LookBack = max(300, NWIN);
set(PLOTNOW);
asset(ASSET_SYMBOL);
net.Keff = KPROJ;
if(net.Keff < 1) net.Keff = 1;
if(net.Keff > net.K) net.Keff = net.K;
net.allocate();
MH.alloc(); ML.alloc(); MR.alloc();
MH.Alpha = MC_Alpha; ML.Alpha = MC_Alpha; MR.Alpha = MC_Alpha;
dt.allocDepthLUT();
dt.DTreeExp = 0;
dt.Root = dt.createNode(MAX_DEPTH);
rt.RT_TreeMaxDepth = MAX_DEPTH;
dt.refreshDepthW();
reindexTreeAndMap();
net.randomizeRP();
net.computeProjection();
rewireEpoch(0,0,0,0);
log.writeEqHeaderOnce();
RewirePos=0; RewirePasses=0;
UpdatePos=0; UpdatePasses=0;
seedBar = -1;
memset(haveSeed,0,sizeof(haveSeed));
// ---- OpenCL advisor init ----
OclReady = 0;
if(ocl.init(ADV_EQ_NF, NET_EQNS)) {
OclReady = 1;
}
AdvCacheBar = -999999;
memset(AdvHave,0,sizeof(AdvHave));
memset(AdvCache,0,sizeof(AdvCache));
ready = 1;
printf("\n[Alpha12] init done: N=%i D=%i K=%i (Keff=%i) Depth=%i est=%i MB OpenCL=%i",
net.N, net.D, net.K, net.Keff, rt.RT_TreeMaxDepth, mem_mb_est(), OclReady);
}
void cleanup() {
if(!ready) return;
if(OclReady) {
ocl.shutdown();
OclReady = 0;
}
MH.freeMem(); ML.freeMem(); MR.freeMem();
dt.freeAll();
pool.freeAll();
net.freeAll();
ready = 0;
}
};
// ======================================================================
// ========================= Zorro DLL entry (bridge) ====================
DLLFUNC void run()
{
if(is(INITRUN)) {
if(!gAlpha12) gAlpha12 = new Alpha12Strategy();
gAlpha12->init();
}
if(!gAlpha12 || !gAlpha12->ready)
return;
if(is(LOOKBACK) || Bar < LookBack) {
gAlpha12->updateAllMarkov();
gAlpha12->net.computeProjection();
return;
}
gAlpha12->onBar();
if(is(EXITRUN)) {
gAlpha12->cleanup();
delete gAlpha12;
gAlpha12 = nullptr;
}
}
137
59,474
Read More
|
|
|
02/05/26 08:43
Leverage is not contained anymore in asset lists. For leverage 2, set MarginCost = -50%.
In the script, MarginCost is then automatically calculated from the price.
1
167
Read More
|
|
|
02/04/26 02:05
solved. LookBack should be greater than 1
1
333
Read More
|
|
|
02/03/26 11:53
New version 3.01.2 uploaded. This one contains the correct Z12+ and Z6+ DLLs.
6
839
Read More
|
|
|
02/02/26 11:43
If it is a virtual drive, the path can indeed require forward slashes. Real paths under Windows use backslashes. Still, it is a strange phenomenon.
15
1,562
Read More
|
|
02/02/26 02:47
I don't know but in variables.h are the real variable names listed, there you can see if they are the same or something different. Thank you. In variables.h, I see: #define SelectWFO g->nSelectWFO #define WFOSelect g->nSelectWFO so, I think they are the same.
2
273
Read More
|
|
|
01/27/26 15:10
After more than one month pause, I will continue the development of the SGT_FW project. I recognized, something went wrong with parametrization of the sgt_new statement. So, I am going to redesign this feature. The secondary goal is the update of the documentation. That is a must, too.
I am happily receiving any idea or proposal about these subjects. Anyway, anybody can come up with other subjects, it is also OK.
33
10,769
Read More
|
|
01/26/26 14:22
I became curious about the graphics engine and would like to see how the Pro version of A8 works. If everything works out for you, I think that A8 is pretty interesting "vintage" stuff. Especially, because you can still use some tools like the 3D model editor and level editor and export your models and levels and use them in modern 3D programs and engines.
4
642
Read More
|
|
|
01/23/26 14:29
The message means that you must use VC++ to create the DLL. Directly starting a .cpp file is only implemented in Zorro S.
If you have already compiled it, make sure not to edit the source afterwards. If the source is newer than the DLL, Zorro assumes that the DLL needs to be compiled again.
1
268
Read More
|
|
|
01/22/26 10:33
It makes sense, thanks.
2
541
Read More
|
|
|
01/19/26 10:47
BTC is traded 24-7, so you should allow bars on weekends and holidays. See "BarMode" in the manual.
1
293
Read More
|
|
01/18/26 19:09
January the 18th 2026 I compiled a texture package for you with free download ! The archive contains abaut 400 textures bmps from my collection in the size 512x512 pixel. They are all (!) seamless and therefore can be tiled very well. You can use them in 3DGamestudio's WED by adding a folder in the texture manager. All textures are freeware and may be used in private or commercial games freely. Download here: Download textures Download may take a while (180MB) NeoDumont Please note: Download will only be available for 3 Months because my webspace is full.
0
183
Read More
|
|
01/18/26 00:48
My original data is in feather file. I want to read them to pandas df, then write to t6 file of zorro. I do not want to save them as csv. Is it possible? The following convert code is generated by Claude, it can generate t6, but I donn't know if it is correct. """
Freqtrade feather to Zorro T6 format converter
T6 structure (32 bytes per record):
- time: double (8 bytes) - OLE datetime (days since 1899-12-30)
- fHigh: float (4 bytes)
- fLow: float (4 bytes)
- fOpen: float (4 bytes)
- fClose: float (4 bytes)
- fVal: float (4 bytes) - price multiplier or point value
- fVol: float (4 bytes) - volume
"""
import os
import struct
import pandas as pd
from datetime import datetime, timezone
from pathlib import Path
# OLE datetime base: 1899-12-30 00:00:00 UTC
OLE_EPOCH = datetime(1899, 12, 30, tzinfo=timezone.utc)
def datetime_to_ole(dt):
"""Convert datetime to OLE datetime format"""
if dt.tzinfo is None:
dt = dt.replace(tzinfo=timezone.utc)
delta = dt - OLE_EPOCH
return delta.total_seconds() / 86400.0 # Convert to days
def write_t6_record(f, time_ole, high, low, open_, close, val, vol):
"""Write single T6 record"""
# Format: d=double, f=float, little-endian
record = struct.pack('<d4f2f', time_ole, high, low, open_, close, val, vol)
f.write(record)
def convert_feather_to_t6(feather_path, t6_path, price_multiplier=1.0):
"""
Convert single feather file to t6 file
Parameters:
feather_path: Path to feather file
t6_path: Output t6 file path
price_multiplier: Price multiplier (for fVal field)
"""
# Read feather file
df = pd.read_feather(feather_path)
# Ensure reverse chronological order (Zorro requires newest to oldest)
df = df.sort_values('date', ascending=False).reset_index(drop=True)
# Write t6 file
with open(t6_path, 'wb') as f:
for _, row in df.iterrows():
time_ole = datetime_to_ole(row['date'].to_pydatetime())
write_t6_record(
f,
time_ole,
float(row['high']),
float(row['low']),
float(row['open']),
float(row['close']),
price_multiplier,
float(row['volume'])
)
return len(df)
def batch_convert(input_dir, output_dir, pattern="*-1h-futures.feather"):
"""
Batch convert all feather files in directory
Parameters:
input_dir: Input directory
output_dir: Output directory
pattern: File matching pattern
"""
input_path = Path(input_dir)
output_path = Path(output_dir)
output_path.mkdir(parents=True, exist_ok=True)
feather_files = list(input_path.glob(pattern))
print(f"Found {len(feather_files)} feather files")
for i, feather_file in enumerate(feather_files, 1):
# Generate output filename: BTC_USDT_USDT-1h-futures.feather -> BTC_USDT.t6
stem = feather_file.stem # Without extension
# Extract symbol name
parts = stem.split('-')
symbol = parts[0].replace('_USDT_USDT', '_USDT')
t6_filename = f"{symbol}.t6"
t6_path = output_path / t6_filename
try:
count = convert_feather_to_t6(feather_file, t6_path)
print(f"[{i}/{len(feather_files)}] {feather_file.name} -> {t6_filename} ({count} records)")
except Exception as e:
print(f"[{i}/{len(feather_files)}] Error: {feather_file.name} - {e}")
if __name__ == "__main__":
# Configure paths
INPUT_DIR = r"D:\freqtradeStudy\user_data\data\binance\futures"
OUTPUT_DIR = r"D:\freqtradeStudy\user_data\data\zorro_t6"
# Execute batch conversion
print("Starting feather -> t6 conversion...")
print(f"Input directory: {INPUT_DIR}")
print(f"Output directory: {OUTPUT_DIR}")
print("-" * 50)
batch_convert(INPUT_DIR, OUTPUT_DIR, pattern="*-1h-futures.feather")
print("-" * 50)
print("Conversion complete!")
0
196
Read More
|
|
|
01/13/26 13:53
I finally resolved it. Now it connect correctly
3
398
Read More
|
|
01/12/26 09:39
OK. "camera always goes up" solved with small texture animation demo: So as a result of my research about a upwards moving camera I like to share the results with you: 1. It is correct: You need a hmp (Ground) below your level geometry to avoid an upgoing camera/player camera. Strangely enough. Note the hmp in my 3DGitt demo screenshot. 2. I created a small demo level with a Guard-player with the t_player action attached to the model. The t_player action has been modified by me so that you can hear footsteps when walking. The cube with the black and white texture animation has been created separately in WED as a simple map, saved out and loaded in the main level with >add map entity<. Because this map entity had no collision detection I put a level prefab block into the map entity to get a stop collision. The barrel has a fx_uvspeed attached, You can see it working. The lava stream at the bottom of the level, again, is a separately created block entity with a texture animation (+0lava to +9lava). It was also build as a simple mesh and then imported. To avoid falling through the lava block I placed a level primitive inside the lava block. The lava stream movement was created in PCXanim. It is not a uvspeed fx. The whole level was compiled with >create meshes< set. Script choice was "Flythrough" t_player.c modified externaly in SED for footstep sounds. Collision sound not yet implemented but planned. Project manager used to add "player parameters". T7 scripts used. You can download the small tech demo 3DGitt.cd here: 3DGitt/A8 tech demo downloadBest wishes ! NeoDumont A7 Extra Edition (Sybex) A8 Extra Edition
4
1,248
Read More
|
|
01/11/26 13:42
Changes: - Fixed null pointer exception in logger initialization for Zorro versions prior to 2.48 - Refactored version management: removed external version file, now using CMakeLists.txt directly - Simplified versioning scheme from 4-part to 3-part semantic versioning (MAJOR.MINOR.PATCH) - Added GitHub release workflow to build both 32-bit and 64-bit binaries with matrix strategy https://github.com/kzhdev/alpaca_zorro_plugin/releases/tag/v1.5.2
0
208
Read More
|
|
|
01/11/26 13:38
Sorry for the late response. The settings dialog appears while the strategy is running.
3
1,076
Read More
|
|
|