| stevehopwoodforex.com https://www.stevehopwoodforex.com/phpBB3/ Print view |
|
| Zorro https://www.stevehopwoodforex.com/phpBB3/viewtopic.php?t=921 |
Page 1 of 12 |
| Author: | SteveHopwood [ Wed Oct 31, 2012 10:25 pm ] |
| Post subject: | Zorro |
I reproduce here a pm from bshoe24 last week: I leave it up to you guys to see if you can make anyrhing of it. |
|
| Author: | bshoe24 [ Thu Nov 01, 2012 12:13 am ] |
| Post subject: | Re: Zorro |
Thanks Steve. I wish i had more to say about this but, i've pretty much said all i know in the PM Steve posted. I am running Zorro on FXCM demo (Z2fx script) but, no trades closed yet (2 open). Maybe more experienced folks around here can take a look at it and give some input if it looks worth anything. |
|
| Author: | SteveHopwood [ Thu Nov 01, 2012 12:30 am ] |
| Post subject: | Re: Zorro |
My limited memory of a pm Gary sent me said that users need to be able to code scripts a la Zorro in order to be able to backtest, so I am probably mis-remembering. Or misunderstanding - Gary talks Geek, after all. |
|
| Author: | garyfritz [ Thu Nov 01, 2012 3:54 am ] |
| Post subject: | Re: Zorro |
Here's what I told Steve: And AmiBroker or NinjaTrader might be a better answer than Tradestation, but I haven't dug into them. |
|
| Author: | babalu4u [ Thu Nov 01, 2012 6:01 am ] |
| Post subject: | |
Example script with explanation Code: Select all At the begin we notice two strange lines that look similar to var definitions: var *Price = series(price()); var *Trend = series(LowPass(Price,1000)); However unlike var definitions, they have an asterisk '*' before the name, and are set to the return value of a series() function call. We define not a single variable here, but a whole series. (C++ programmers might notice that we in fact define a pointer, but that needs not bother us now). A series is a variable with a history - the series begins with the current variable value, then comes the value the variable had one bar before, then the value from two bars before and so on. This is mostly used for price curves and their derivatives. For instance, we could use a series to take the current price of an asset, compare it with the price from 1 bar before, and do some other things dependent on past prices. The series is the ideal construct for such price calculations. The current value of a series can be used by adding a [0] to the series name; for the value from one bar before add a [1], for two bars before add a [2] and so on. So, in Alice's code Price[0] would be the current value of the Price series, and Price[1] the value from 1 hour ago. Many trade platform languages - for instance, EasyLanguage - support series this way; usually indicator, statistics, and financial functions all use series instead of single variables. We'll encounter series very often in trade scripts and will become familiar with them. The series() function can be used to convert a single variable to a series. The variable or value for filling the series is normally passed to that function. However, we're not using a variable here, but the return value of a function call. var *Price = series(price()); means: define a var series with the name "Price" and fill it with the return value of the price() function. We've learned in the last programming lesson how to 'nest' function calls this way, passing the return values of functions as parameters to other functions. The price() function returns the mean price of the selected asset at the current bar. There are also priceOpen(), priceClose(), priceHigh() and priceLow() functions that return the open, close, maximum and minimum price of the bar; however, the mean price is usually the best for trend trading strategies. It's averaged over all prices inside the bar and thus generates a smoother price curve. var *Trend = series(LowPass(Price,1000)); The next line defines a series named "Trend" and fills it with the return value from the LowPass function. As you probably guessed, this function is the second order lowpass filter. Its parameters are the previously defined Price series and a cutoff value, which Alice has set to 1000 bars. 1000 bars are about 2 months (1 week = 24*5 = 120 hours). Thus the lowpass filter attenuates all the wiggles and jaggies of the Price series that are shorter than 2 months, but it does not affect the trend or long-term cycles above two months. It has a similar smoothing effect as a Moving Average function, but has the advantages of a better reproduction of the price curve and less lag. This means the return value of a lowpass filter function isn't as delayed as the return value of a Moving Average function that is normally used for trend trading. The script can react faster on price changes, and thus generate better profit. The next line places a stop loss limit: Stop = 2*ATR(100); Stop is a predefined variable that Zorro knows already, so we don't have to define it. It's the maximum allowed loss of the trade; the position is sold immediately when it lost more than the given value. The limit here is given by 2*ATR(100). The ATR function is a standard indicator. It returns the Average Price Range - meaning the average height of a candle - within a certain number of bars, here the last 100 bars. So the position is sold when the loss exceeds two times the average candle height of the last 100 bars. By setting Stop not at a fixed value, but at a value dependent on the fluctuation of the price, Alice adapts the stop loss to the market situation. When the price fluctuates a lot, higher losses are allowed. Otherwise trades would be stopped out too early when the price jumps down just for a moment. A stop loss should be used in all trade strategies. It not only limits losses, it also allows Zorro's trade engine to better calculate the risk per trade and generate a more accurate performance analysis. The next lines are the core of Alice's strategy: Code: Select all C source code of the LowPass, peak, and valley functions: Code: Select all Read more: http://forums.babypips.com/expert-advis ... z2AwnVc4AJ |
|
| Author: | jcl [ Thu Nov 01, 2012 9:57 am ] |
| Post subject: | Re: Zorro |
Thanks for leading me to this thread, and congrats for the quality of this forum. I'm the documentation guy for Zorro, so I can look in this forum from time to time and answer questions about it. What was said so far about Zorro is correct, except for the opinion that "EAs are doing all kinds of intense detailed manipulations". The limitations of EAs are just the reason for the need of more serious platforms, such as Ninja, Amibroker, and of course Zorro. But when you run into any problems scripting an EA in Zorro, just ask and I'll try to help. |
|
| Author: | garyfritz [ Thu Nov 01, 2012 4:59 pm ] |
| Post subject: | Re: Zorro |
Thanks, jcl. (Guys, jcl is a huge help on the Zorro forum!) What I meant by the "intense detailed" comment was that EAs are triggered on every tick, and quite frequently EAs are written to do all kinds of calculations (open/close positions, move stops, calculate open equity, etc) on a tick-by-tick basis. I don't believe Zorro is designed to do that kind of low-level calculation? |
|
| Author: | jcl [ Thu Nov 01, 2012 6:19 pm ] |
| Post subject: | Re: Zorro |
I believe all platforms can trigger functions on every tick and do tick based calculations; otherwise handling open trades would be sort of difficult. Zorro can certainly do it. |
|
| Author: | garyfritz [ Thu Nov 01, 2012 6:38 pm ] |
| Post subject: | Re: Zorro |
I thought Zorro handled the open trades itself -- receiving every tick if necessary, etc -- but I didn't think it brought those ticks up to the script level. Can you do script operations on every tick? E.g. can a Zorro script say "on this tick the price is X and the Y is Z, so I will open a trade NOW" ? Zorro could open a trade at X with a stop, but an EA can look at the Y on every tick to see if the Z condition is met. The EA could also calculate a different X entry price on every tick. Can Zorro do that? (Tradestation can't, BTW, at least in its default mode. It's possible to run it in tick-by-tick mode but usually systems act at the end of a bar, and you set stops for the duration of the next bar.) |
|
| Author: | jcl [ Fri Nov 02, 2012 8:17 am ] |
| Post subject: | Re: Zorro |
Yes, sure. Systems normally do not use a tick triggered function for opening trades, but they need such a function for closing trades - otherwise you could not define individual exit algorithms. Zorro can do it and I should know - I had to write the tick triggered exit script for the included Z1 and Z2 systems. |
|
| All times are UTC | Page 1 of 12 |
|
Powered by phpBB® Forum Software © phpBB Limited |
|