Gamestudio Links
Zorro Links
Newest Posts
Newbie Questions
by fairtrader. 12/07/23 20:06
zorro license, IB connection
by miwok. 12/07/23 16:13
Zorro Trader GPT
by TipmyPip. 12/04/23 11:34
Square root rule
by Smallz. 12/02/23 09:15
RTest not found error
by TipmyPip. 12/01/23 21:43
neural function for Python to [Train]
by TipmyPip. 12/01/23 14:47
Xor Memory Problem.
by TipmyPip. 11/28/23 14:23
Training with command line parameters
by TipmyPip. 11/26/23 08:42
AUM Magazine
Latest Screens
A psychological thriller game
SHADOW (2014)
Tactics of World War I
Who's Online Now
2 registered members (AndrewAMD, TipmyPip), 645 guests, and 10 spiders.
Key: Admin, Global Mod, Mod
Newest Members
fairtrader, hus, Vurtis, Harry5, KelvinC
19020 Registered Users
Active Threads | Active Posts | Unanswered Today | Since Yesterday | This Week
Starting with Zorro
12/07/23 20:06
Here's what ChatGPT tells me:

Account Opening Process: To qualify, you usually need to open an OANDA account through a specific link provided by Zorro. This ensures that your account is associated with the Zorro-OANDA partnership.

Has anyone been through this process with Oanda?

8 270 Read More
Starting with Zorro
12/07/23 16:13
Got it, thank you for supporting
4 132 Read More
Starting with Zorro
12/04/23 11:34
Thank you too.
10 730 Read More
Automated Trading
12/02/23 09:15
Originally Posted by jcl
You got two systems A and B. You invest $1000 in A. After a year, the account is at $2000. Now you stop A, go on a long round-the-world trip, then come back and start B. B has never been traded before. Do you invest the full $2000, or only $1440?

Your aunt has traded system A and has doubled her account to $2000 after a year. Now she gives you the $2000 and suggests that you use it for trading the same system. How much do you invest?

You know that your aunt has traded system A and has doubled her account to $2000 within a year. By chance you also have $2000 on your savings account. You now want to use it and start trading the same system. You have never traded before. Do you invest your $2000, or only $1440?

I know this is an old thread but I would like to ask an additional question to your scenarios, in particular this one:
You got two systems A and B. You invest $1000 in A. After a year, the account is at $2000. Now you stop A, go on a long round-the-world trip, then come back and start B. B has never been traded before. Do you invest the full $2000, or only $1440?

Let's say I trade one of the Z-systems and then with a new release of Zorro, I update the .par and the .fac files. Am I now trading a "new" system? Is this a similar consideration like the above example?

Thank you!
22 3,715 Read More
Zorro Scripts
12/01/23 21:43
You're welcome. I am so happy, now you can enjoy yourself, and contribute to all of us, if you please, Thank you too...
3 144 Read More
Zorro Scripts
12/01/23 14:47
How about :

// Optimization parameters - set these as default values
var learning_rate = 0.001;
var num_neurons = 50;
var dropout_rate = 0.3;
var epochs = 100;
var batch_size = 32;

// Function to handle neural network operations
var neural(int Status, int model, int NumSignals, void* Data)
    if(!wait(0)) return 0;

    // Optimization parameters - adjust these as needed within optimize calls
    learning_rate = optimize(0.001, 0.0001, 0.01, 0.0001);
    num_neurons = optimize(50, 10, 100, 10);
    dropout_rate = optimize(0.3, 0.1, 0.5, 0.1);
    epochs = optimize(100, 50, 200, 50);
    batch_size = optimize(32, 16, 64, 16);

    // open a Python script with the same name as the strategy script  
    if(Status == NEURAL_INIT) {
        if(!pyStart(strf("",Script),1)) return 0;
        return 1;

    // export batch training samples and call the Python training function
    if(Status == NEURAL_TRAIN) {
        string name = strf("Data\\signals%i.csv",Core);
        pyX(strf("XY = pandas.read_csv('%s%s',header = None)",slash(ZorroFolder),slash(name)));

        // Pass optimization parameters to Python
        pySet("learning_rate", &learning_rate, 1);
        pySet("num_neurons", &num_neurons, 1);
        pySet("dropout_rate", &dropout_rate, 1);
        pySet("epochs", &epochs, 1);
        pySet("batch_size", &batch_size, 1);

        if(!pyX(strf("neural_train(%i,XY,learning_rate,num_neurons,dropout_rate,epochs,batch_size)", model+1)))
            return 0;
        return 1;

    // predict the target with the Python predict function
    if(Status == NEURAL_PREDICT) {
        pyX(strf("Y = neural_predict(%i,X)", model+1));
        return pyVar("Y[0]");

    // save all trained models  
    if(Status == NEURAL_SAVE) {
        print(TO_ANY,"\nStore %s", strrchr(Data,'\\')+1);
        return pyX(strf("neural_save('%s')", slash(Data)));

    // load all trained models  
    if(Status == NEURAL_LOAD) {
        printf("\nLoad %s", strrchr(Data,'\\')+1);
        return pyX(strf("neural_load('%s')", slash(Data)));

    return 1;

And a new python code:

import numpy as np
from tensorflow import keras
from tensorflow.keras.layers import Dense, Dropout
from tensorflow.keras.optimizers import RMSprop

models = []

def neural_train(model, XY, learning_rate, num_neurons, dropout_rate, epochs, batch_size):
    X = np.array(XY.iloc[:, :-1])
    Y = XY.iloc[:, -1].apply(lambda x: 1 if x > 0 else 0)

    model = keras.models.Sequential()
    model.add(Dense(num_neurons, activation='relu', input_shape=(X.shape[1],)))
    model.add(Dense(1, activation='sigmoid'))

                  metrics=['accuracy']), Y, epochs=epochs, batch_size=batch_size, validation_split=0, shuffle=False)


def neural_predict(model, X):
    if isinstance(X, list):
        X = np.array(X)
    elif isinstance(X, np.ndarray) and X.ndim == 1:
        X = X.reshape(1, -1)

    Y = models[model].predict(X)
    return [1 if y > 0.5 else 0 for y in Y]

def neural_save(name):
    serialized_models = [model.to_json() for model in models]
    with open(name, 'w') as file:
        for serialized_model in serialized_models:
            file.write(serialized_model + '\n')

def neural_load(name):
    global models
    models = []
    with open(name, 'r') as file:
        for line in file:
            model = keras.models.model_from_json(line.strip())

def neural_init():
    global models
    models = []

# Example usage:
# neural_init()
# neural_train(0, XY, 0.001, 50, 0.3, 100, 32)
# result = neural_predict(0, X)
# neural_save('models.txt')
# neural_load('models.txt')

7 654 Read More
Zorro Scripts
11/28/23 14:23
I do understand, And I respect the wisdom of your choices, But if you can describe your solution with half a sentence, how come you can't show me what is the meaning of: "putting a dummy struct variable upstream of your size of calls"
it seems that sentence is describing initializing a struct with whatever you have difficulty describing in code because most likely you don't want to try to solve a problem which you don't have a solution for, let alone the money you don't have time for.

But you do have the time to prove your wisdom with no intentions by describing partial solutions that don't exist.

Our Future interactions might be beyond the wisdom of your current limitations, where I suppose you can't imagine other ways to make money.
If you think I need to pay for a limitation that lite-C can't resolve.

(The fact you stated: "but only because I'm not interested in solving it myself," proves your so-called suggestion doesn't have any logical basis, because you have already stated that you are not interested in solving it for yourself, meaning you don't have a clue of how to solve it, which also means you share your suggestions only to get some emotional credit for showing of your unlogical description of whatever you can't imagine with "putting a dummy struct variable upstream of your size of calls" in relation to the code I have written, This also proves that giving sarcastic supervision, doesn't make you a professional programmer, Sir.)
13 681 Read More
Zorro Scripts
11/26/23 08:42
The issue you're encountering, where the Command[0] parameter seems to be set to 0 instead of the passed value when training a script, might be related to the way command-line parameters are handled in Zorro, especially in different modes (like training versus running).

In Zorro, command-line parameters are accessible through the Command array in the script. However, there are some nuances to be aware of:

Initialization Timing: The command-line parameters are usually parsed and initialized before the run function is executed. However, if you're observing that the parameters are not correctly initialized during training, it could be a timing or initialization issue specific to the training mode.

Correct Parameter Index: Ensure that you're using the correct index for accessing the command-line parameters. Command[0] is the first command-line parameter, Command[1] is the second, and so on.

Parameter Parsing: Check if the command-line parameter is correctly parsed and converted to the desired data type. For instance, if you're passing a date like 20230930, you might need to convert it from a string to an integer or a specific date format that Zorro understands.

Batch File Syntax: Ensure the batch file is correctly formatted and passing the parameters as intended. The command should look something like this:

Zorro.exe -run MyScript -i 20230930

Zorro Version: You mentioned using Zorro version 2.56 with an S License. It's worth checking the release notes or updates for your version to see if there are any known bugs or changes regarding command-line parameter handling.

Debugging: Use print statements to debug the script. Print out the value of Command[0] at different points in your script to check when it gets initialized and what value it holds.

Alternative Approach: As a workaround, you could try using a different method to pass the end date. For example, you could read the end date from a file at the start of your script if the direct command-line approach continues to pose issues.
2 288 Read More
Starting with Zorro
11/26/23 08:30
When combining USD and BTC pairs in your asset loop in Zorro S, and ensuring they appear in the Zorro dashboard, there are several key steps and considerations:

Check Asset Configuration: Ensure that both USD and BTC pairs are properly configured in the Assets file. This file contains definitions for all the assets that your Zorro S instance can trade. It's important to check that the BTC pairs are listed there along with the correct settings (like pip cost, lot size, leverage, etc.).

Asset Loop in Script: In your lite-C script, you need to loop through both sets of assets. This typically involves setting the assetList string to include all desired assets. For example:

function run() {
    while(asset(loop(Assets))) {
        // Your trading logic here

Ensure that your BTC pairs are correctly named as per the broker's naming convention.

Broker API Compatibility: Check if your broker's API supports BTC pairs and is properly integrated with Zorro S. Some brokers might have different APIs or require special setup for cryptocurrency trading.

Timeframe Setting: To set a 1-hour timeframe for all assets, use the BarPeriod variable. For example:

function run() {
    BarPeriod = 60; // Set to 60 minutes for 1-hour bars
    // Rest of your code

Broker Plugin and Asset Subscription: Ensure that the broker plugin you are using supports BTC pairs and is properly configured. Some broker plugins might need specific settings or parameters to enable cryptocurrency trading.

Zorro Dashboard: If the assets are not showing up in the Zorro dashboard, it could be due to a mismatch in the asset names or a configuration issue. Make sure the asset names used in the script match those in the broker's platform and the Assets file.

Check for Errors: Use the Zorro log or the print function to check for any errors or messages that might indicate why the BTC pairs are not being registered. You can also refer to the "Zorro lite-C Error Troubleshooting.pdf" document from your uploaded files for specific guidance on handling errors.

Script Reload: Sometimes, simply reloading the script or restarting Zorro can solve issues related to asset loading.

If you've checked all these and still face issues, it could be helpful to reach out to the broker's support or the Zorro Trader community for specific insights related to the broker or the platform you're using.

Hope This helps.
1 142 Read More
Zorro and the Brokers
11/21/23 09:17
Thanks for your response. Unfortunately, many stock and ETF brokers have an annual swap of around 7-8%, which, in my opinion, is immensely high. These investments would only be suitable for short-term trading systems.

Unfortunately, I cannot find a decent broker that easily connects with Zorro and instead of swap fees, simply charges a one-time order fee.

Now, I see two options:

The forum has a good broker recommendation.
I continue searching for an ETF/stock broker with API integration and write the script myself.

Thank you!
2 321 Read More
Starting with Zorro
11/19/23 13:29
Thank you jcl! Just a quick question, in this case when I am in Trade mode, is that they will still store live data somehow so as to compute those indicator or signal? And can I specific the source? Right now I am using assethistory, but I guess it works for test mode only? Thanks again for your time
2 350 Read More
Jobs Wanted
11/18/23 10:49
31 7,002 Read More
Jobs Wanted
11/17/23 15:11
Looking for new projects to score!
88 29,544 Read More
Zorro Future
11/15/23 09:11
What difference is this to the Objective value? It can also be set by trade results. Can you give an Example?
1 254 Read More

Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at)

Powered by UBB.threads™ PHP Forum Software 7.7.1