Hello World from Zorro Trader

In the C programming language, the “Hello World” program is traditionally used to introduce new programmers to the language. The program simply prints the text “Hello, world!” to the screen in Zorro Trader.

While the “Hello World” program in Zorro Trader is very simple, it can be used to teach the basics of C programming. For example, the program can be used to show how to use the printf function to print text to the screen. It can also be used to show how to use the semicolon ; to end a statement.

The “Hello World” program can also be used to introduce the concept of comments. Comments are lines of text that are not executed by the program, but are used to add notes for the programmer. In C, comments are denoted by a forward slash and an asterisk, like this:

/* This is a comment */

Comments can be used to explain what a program does, or to add notes about things that need to be changed in Zorro Trader.

This works well in Zorro Trader.

A loop is a sequence of instructions that is repeated until a certain condition is met. In C, there are three main types of loops: for, while, and dowhile. The for loop is the most common type of loop. It is used to execute a certain number of iterations, usually based on a counter variable. The syntax for a for loop is: for (initialization; condition; increment) { // Statements }

The while loop is similar to the for loop, except that it does not require a counter variable. The syntax for a while loop is: while (condition) { // Statements } The dowhile loop is similar to the while loop, except that it always executes at least once. The syntax for a dowhile loop is: do { // Statements } while (condition); In Zorro Trader, loops are used extensively in strategies. For example, a strategy may use a for loop to iterate over a list of stocks. The condition in the for loop would be the number of stocks in the list. The increment would be the stock price.

While loops are often used in Zorro Trader to keep track of the current bar. The condition in the while loop would be the number of bars in the current timeframe. The increment would be the bar number. Dowhile loops are not used as often in Zorro Trader, but they can be used to ensure that a certain condition is met before executing a trade. For example, a dowhile loop could be used to check that the account has enough money to cover the trade. The condition in the dowhile loop would be the account balance. The increment would be the trade size.