|
|
|
|
webGL
by Ezzett. 11/27/25 23:22
|
|
|
|
|
|
|
|
|
|
|
|
|
2 registered members (TipmyPip, Quad),
10,636
guests, and 3
spiders. |
|
Key:
Admin,
Global Mod,
Mod
|
|
|
Yesterday at 20:36
The parameter dimension is not relevant for the peak filtering, since you can apply a lowpass filter in any dimension. But the training method is. It is only implemented for Ascent and brute force, not for Genetic. For implementing your own algorithm, look in the manual for the parameters() function. Thanks for the info. When looking into the parameters() function, I understand that it allows me to customize the parameter list which is evaluated at each optimization iteration, however what I am interested is in applying my own algorithm to the full list of results calculated through brute force. Is there any built in function which I can modify to do that, or would I need to manually do it after the optimize loop is completed? Thanks
2
85
Read More
|
|
Yesterday at 09:38
This script implements a fully panel-driven EUR/USD trend-following strategy that uses a custom linear regression slope as its main trend filter and exposes all key parameters through a Zorro control panel. The LinearRegressionSlope function computes the slope of a regression line over a configurable number of bars (SlopePeriod), and this slope is used, together with a configurable SMA (SmaPeriod) and RSI (RsiPeriod), to assess trend and overbought/oversold conditions. Global parameters define whether trading is enabled, the risk per trade as a percentage of equity, ATR period and ATR-based stop multiplier, as well as minimum and maximum stop distances and position sizes. A click handler reacts to user edits in the panel: it toggles trading on/off, updates numeric parameters entered in the panel cells, and provides a “ResetEq” button to reset capital for demo/testing. In run(), all parameters are first sanitized with clamp() to keep them within sensible bounds, then indicators (SMA, RSI, ATR) and the regression slope are calculated, the slope is displayed in the panel, and position size is derived from risk percent, equity, and stop size. The panel is created once at INITRUN with labeled rows for each parameter and updated every bar for the live slope value, while the trading logic simply enters a long position when trading is enabled, price crosses above the SMA, and normalized RSI is below 0.7, plotting the normalized RSI for visual monitoring.
//////////////////////////////////////////////////////////
// Linear regression slope with custom period
//////////////////////////////////////////////////////////
var LinearRegressionSlope(vars Data, int Period)
{
var sumX = 0;
var sumY = 0;
var sumXY = 0;
var sumX2 = 0;
int i;
for(i = 0; i < Period; i++) {
sumX += i;
sumY += Data[i];
sumXY += i * Data[i];
sumX2 += i * i;
}
var numerator = Period * sumXY - sumX * sumY;
var denominator = Period * sumX2 - sumX * sumX;
if(denominator != 0)
return numerator / denominator;
else
return 0;
}
//////////////////////////////////////////////////////////
// Global Parameters (editable via panel)
//////////////////////////////////////////////////////////
int EnableTrade = 1; // trading on/off
var InputRiskPct = 1.0; // risk per trade in percent
int SlopePeriod = 10; // bars used for regression slope
int SmaPeriod = 20; // SMA period
int RsiPeriod = 14; // RSI period
int AtrPeriod = 14; // ATR period
var StopATRMult = 2.0; // stop = ATR * this
var StopMin = 10; // min stop (price distance)
var StopMax = 50; // max stop
var PosMin = 1; // min position size
var PosMax = 5; // max position size
var DisplaySlope = 0; // for live slope display in the panel
//////////////////////////////////////////////////////////
// Click handler for panel interactions
//////////////////////////////////////////////////////////
function click(int row,int col)
{
string Text;
if(!is(RUNNING)) return; // ignore when script not running
if(row < 0) return; // ignore Result/Action/Asset events
Text = panelGet(row,col);
// Row / column mapping
// 0: Enable trading (button)
// 1: Risk %
// 2: Slope period
// 3: SMA period
// 4: RSI period
// 5: ATR period
// 6: Stop ATR mult
// 7: Stop min
// 8: Stop max
// 9: Pos min
// 10: Pos max
// 11: Reset equity button
if(row == 0 && col == 1) {
// Toggle trading
if(EnableTrade)
EnableTrade = 0;
else
EnableTrade = 1;
panelSet(0,1, ifelse(EnableTrade,"On","Off"),0,0,4);
}
else if(row == 1 && col == 1) {
InputRiskPct = atof(Text);
}
else if(row == 2 && col == 1) {
SlopePeriod = atoi(Text);
}
else if(row == 3 && col == 1) {
SmaPeriod = atoi(Text);
}
else if(row == 4 && col == 1) {
RsiPeriod = atoi(Text);
}
else if(row == 5 && col == 1) {
AtrPeriod = atoi(Text);
}
else if(row == 6 && col == 1) {
StopATRMult = atof(Text);
}
else if(row == 7 && col == 1) {
StopMin = atof(Text);
}
else if(row == 8 && col == 1) {
StopMax = atof(Text);
}
else if(row == 9 && col == 1) {
PosMin = atof(Text);
}
else if(row == 10 && col == 1) {
PosMax = atof(Text);
}
else if(row == 11 && col == 0) {
// Reset equity button
Capital = 100000; // demo reset
}
}
//////////////////////////////////////////////////////////
// Main strategy
//////////////////////////////////////////////////////////
function run()
{
vars Price;
var sma, rsi, slopeVal, trend, atr, stopLevel, normRSI;
var tradeRisk, posSize;
string txt;
set(PARAMETERS);
BarPeriod = 15;
StartDate = 20220101;
asset("EUR/USD");
// Clamp and sanitize parameter ranges to avoid nonsense
SlopePeriod = clamp(SlopePeriod, 5, 200);
SmaPeriod = clamp(SmaPeriod, 2, 200);
RsiPeriod = clamp(RsiPeriod, 2, 200);
AtrPeriod = clamp(AtrPeriod, 2, 200);
StopATRMult = clamp(StopATRMult, 0.5, 10);
StopMin = clamp(StopMin, 1, 500);
StopMax = clamp(StopMax, StopMin, 1000);
PosMin = clamp(PosMin, 0.01, 100);
PosMax = clamp(PosMax, PosMin, 1000);
InputRiskPct = clamp(InputRiskPct, 0.1, 20); // 0.1% .. 20%
Price = series(priceClose());
sma = SMA(Price, SmaPeriod);
rsi = RSI(Price, RsiPeriod);
slopeVal = LinearRegressionSlope(Price, SlopePeriod);
DisplaySlope = slopeVal;
trend = sign(slopeVal);
atr = ATR(AtrPeriod);
stopLevel = clamp(atr * StopATRMult, StopMin, StopMax);
normRSI = clamp(rsi / 100, 0, 1);
// Risk-based position sizing using percentage from panel
tradeRisk = InputRiskPct / 100 * Equity;
posSize = clamp(tradeRisk / fix0(stopLevel), PosMin, PosMax);
// Panel setup only once at init
if(is(INITRUN))
{
// 12 rows, 2 columns, default color (0), cell width 80 px
panel(12,2,0,80);
// Row 0: Enable trading button
panelSet(0,0,"Enable",0,0,1);
panelSet(0,1, ifelse(EnableTrade,"On","Off"),0,0,4);
// Row 1: Risk %
panelSet(1,0,"Risk %",0,0,1);
txt = strf("%.2f",InputRiskPct);
panelSet(1,1,txt,0,0,2);
// Row 2: Slope period
panelSet(2,0,"SlopePer",0,0,1);
txt = strf("%i",SlopePeriod);
panelSet(2,1,txt,0,0,2);
// Row 3: SMA period
panelSet(3,0,"SMA Per",0,0,1);
txt = strf("%i",SmaPeriod);
panelSet(3,1,txt,0,0,2);
// Row 4: RSI period
panelSet(4,0,"RSI Per",0,0,1);
txt = strf("%i",RsiPeriod);
panelSet(4,1,txt,0,0,2);
// Row 5: ATR period
panelSet(5,0,"ATR Per",0,0,1);
txt = strf("%i",AtrPeriod);
panelSet(5,1,txt,0,0,2);
// Row 6: Stop ATR mult
panelSet(6,0,"Stop xATR",0,0,1);
txt = strf("%.2f",StopATRMult);
panelSet(6,1,txt,0,0,2);
// Row 7: Stop min
panelSet(7,0,"StopMin",0,0,1);
txt = strf("%.2f",StopMin);
panelSet(7,1,txt,0,0,2);
// Row 8: Stop max
panelSet(8,0,"StopMax",0,0,1);
txt = strf("%.2f",StopMax);
panelSet(8,1,txt,0,0,2);
// Row 9: Pos min
panelSet(9,0,"PosMin",0,0,1);
txt = strf("%.2f",PosMin);
panelSet(9,1,txt,0,0,2);
// Row 10: Pos max
panelSet(10,0,"PosMax",0,0,1);
txt = strf("%.2f",PosMax);
panelSet(10,1,txt,0,0,2);
// Row 11: Reset + Slope display (label; value updated each bar)
panelSet(11,0,"ResetEq",0,0,4);
txt = strf("%.4f",DisplaySlope);
panelSet(11,1,txt,0,0,1);
}
// Update slope display every bar
txt = strf("%.4f",DisplaySlope);
panelSet(11,1,txt,0,0,1);
// Trading logic
if(EnableTrade && crossOver(Price, sma) && normRSI < 0.7)
enterLong(posSize);
plot("RSI", normRSI, NEW, RED);
}
115
39,219
Read More
|
|
11/27/25 23:22
There was talk about open sourcing the code some years ago, but in the end it wasn't possible because there are certain parts of the engine which are proprietary third party code, which cannot be released as open source. And to stay on topic, there are newer engines with WebGL support, so if somebody wants to do some 3D stuff for web browsers, it's maybe a good idea to check out game engines like CopperCube: https://www.ambiera.com/coppercube/
3
796
Read More
|
|
|
11/27/25 23:10
That's very generous. Thank you very much!
1
128
Read More
|
|
|
11/27/25 21:21
Hi all, new to Zorro since a few weeks ago, so far gladly impressed with its power and capabilities! However one of the things I am missing is the ability to debug entries and exits in a meaningful way by using the chart viewer, as it is difficult to know the values of the indicators at each bar. Is there any type of cursor/crosshair mode where the values of the indicators and other lines on the chart show their values when the mouse is hovered over? A bit like the tradingview interface which comes in pretty handy to debug entries and exits.
Or else, is there any way to enhance the chart viewer to make it more interactive? I know the viewer will not necessarily lead to having better strategies, but it would greatly ease the validation work!
Thanks!
0
40
Read More
|
|
|
11/27/25 13:58
Ok, it's not yet Friday, but anyway: For the next days you can get Zorro S at a reduced price!
5% discount for an annual subscription with the discount code: ZASD14466
10% discount for a permanent license with the discount code: ZPL5B28B8
15% discount for an infinite license or upgrade with the discount code: ZILD11AE
The discount codes are valid for the next 3 days.
0
142
Read More
|
|
|
11/27/25 13:51
The screens look interesting. But I see no connection to HFT. They appear only to visualize the order book. This is useful for manual trading, but for automated trading you have already access to the order book.
1
219
Read More
|
|
|
11/27/25 13:44
Can you contact the support and send them the log? There can be many reasons of a crash, but for helping you we need to see what happened. If you want to start it again, set Verbose to 15 for activating diagnostics.
5
1,179
Read More
|
|
|
11/24/25 16:25
Looking for new projects!
100
53,131
Read More
|
|
|
11/20/25 22:32
Hi AndrewAMD,
Thank you for your reply. You are correct.
Here are three versions of the script, just in case someone else runs into the same issue. The optimize() call is placed at three different positions. One can clearly see what works and what doesn't. Thanks to Petra and AndrewAMD, I think I get it now
6
653
Read More
|
|
|
11/20/25 17:28
Thanks Petra,
I am wondering why I got this error:
1. Not using a command line statement in the script 2. Having Zorro -S running?
6
987
Read More
|
|
|
11/18/25 15:22
Hi, for WFO optimized strategy, is it recommended to run MRC.c script with WFO enabled or disabled?
0
104
Read More
|
|
|
11/17/25 09:56
OK. Just found out:
Prepare a WAD with an animated texture from a set of texture bmps like +0vulcan.bmp to +9vulcan.bmp. You can add a set of 10 textures to a WAD in one go.
Create a block or prefab in an new empty level in WAD and add an animated texture to the block. Then compile this map with disabled "create meshes" (checkbox set off) as a >simple map< ! Save it out and import it into your WED Level, created with "create meshes" set before, by"ADD MAP". This way the very useful t7 functions and block animted textures do work together.
NOTE (!): Here I mean WAD animated textures from a set of bmps like +0Vulcan.bmp to +9vulcan.bmp only ! I don't know how to get animations like *ooze going. I assume they need a special FX. Did not check this out.
If you need sets of animated textures you can use PCXanim, also available on this forum. Import a ten frame animation and export them with "export bmps". Enter a base name. Enumeration und .bmp extenter will be added automatically. Works ony with 10 frame animation. Most PCXanim animations are good for simple scifi games. If you want ro create a world with next gen graphics you should get a professional version of GSTUDIO, which uses shaders.
The command "Tex_CYCLES = 10" let you set the speed of the texture animation.
Best wishes !
NeoDumont
A7 Extra Edition A8 Extra Edition
3
596
Read More
|
|
|
11/15/25 09:35
I believe you can get free continuous futures data from Stooq, but only in D1 resolution, otherwise it is not free.
4
820
Read More
|
|
|
11/13/25 10:42
Well, script is running without errors. But dont get plots on mt4 chart. Can someone tell me how to return a brokercommand value (check if !=0)? on the mt4 terminal there are no related messages in Experts or Journal tab.
Zorro manual "MT4/5 Bridge" gives advise on how to get a return, i have read it ... but not really understood. And seems to me like explaination for "own generated broker commands". Not my case, already predefined. so how to proceed?
4
720
Read More
|
|
|
11/08/25 16:09
This strategy seems to be very interesting. I tested it on a Demo Account with promising results. Is there already a date for the new Forex book which includes the description of the Algo? Martin
2
433
Read More
|
|
|