Enter Trade with managing function

Posted By: Gattaca

Enter Trade with managing function - 10/25/12 19:44

from the manual: The trade function is called every tick.
So my questions are: can this be backtested with the historic data you provide? Do you use this function in Z1/Z2?
Posted By: jcl

Re: Enter Trade with managing function - 10/26/12 06:09

For backtesting it, set the TICKS flag:

http://zorro-trader.com/manual/en/mode.htm

and yes, it is used in Z1 and Z2.
Posted By: stevegee58

Re: Enter Trade with managing function - 10/26/12 11:07

I just read your link and I want to make sure I understand clearly.

1) If your base data is M1 and you are running the test in H1 the backtest normally uses H1 bars for trade management.
2) If you want to use the M1 data for more accurate trade management during H1 backtest, set the TICKS mode flag.

Is that correct?
Posted By: jcl

Re: Enter Trade with managing function - 10/26/12 12:16

Yes, that's correct.
Posted By: stevegee58

Re: Enter Trade with managing function - 10/26/12 14:33

As a follow-on, if I have M1 base data and run a backtest on M1 do you create synthetic ticks? For instance you can at least create 2 synthetic ticks, one for the open and one for the close. You could even create more than 2 ticks by guessing the path of price action based on the high and low.
Posted By: jcl

Re: Enter Trade with managing function - 10/29/12 14:48

No, we do not create synthetic ticks in this version. An early Zorro version used synthetic ticks, but we found that the result was more different to real ticks then not using synthetic ticks at all.
Posted By: TankWolf

Re: Enter Trade with managing function - 12/15/12 02:39

jcl Im trying to use the trade function on one of my strategies that used H1 bars but I want trades to trigger during a bar if certain entry conditions have been met and Ive set the TICKS flag and in my backtest chart results looks to be exactly what it should be yet when I run the strategy in live trading, the trades are not triggering at all and Im just getting a ton of Missed Entry at Bar errors.

Also when I look at the logfile from the backtest that looks correct on the chart results. It shows this:

Quote:

13520: 10.03. 01:00] 0p 2/1
[GBP/USD::S] Missed entry at bar 13520
[AUD/USD::L] Missed entry at bar 13520
[NZD/USD::L] Missed entry at bar 13520
[USD/CAD::S] Missed entry at bar 13520
[USD/CAD::S2103] Short 100@1.0280 Risk 422

[13521: 10.03. 02:00] 0p 3/1
[EUR/USD::S1901] Target 90@1.3589: +129$ at 02:37
[GBP/USD::S] Missed entry at bar 13521
[AUD/USD::L] Missed entry at bar 13521
[NZD/USD::L] Missed entry at bar 13521

[13522: 10.03. 03:00] 1607p 3/1
[GBP/USD::S] Missed entry at bar 13522
[AUD/USD::L] Missed entry at bar 13522
[NZD/USD::L] Missed entry at bar 13522

[13523: 10.03. 04:00] 1607p 3/1
[EUR/USD::S] Missed entry at bar 13523
[GBP/USD::S] Missed entry at bar 13523
[AUD/USD::L] Missed entry at bar 13523
[NZD/USD::L] Missed entry at bar 13523
[EUR/USD::S2403] Short 91@1.3605 Risk 383


The trades on the logfile say they are opening at the start of each bar but the chart results show trades trigging where they should during H1 bars. Any help would be appreciated.

P.S - Here is a code Im using for entry just incase Im doing something wrong.
Quote:

if(ConditionA > ConditionB && NumOpenLong == 0) {
Entry = EMA1[0] - Close[0];
Stop = 10*PIP;
TakeProfit = 50*PIP;
enterLong(0,Entry,Stop,TakeProfit);
}
Posted By: jcl

Re: Enter Trade with managing function - 12/15/12 08:55

The .log looks ok to me, so I am not sure what the problem is. If you want to check the start and end time of a trade, open the .csv spreadsheet in Excel. You can find the description of the spreadsheet in the manual under "data export".

Posted By: TankWolf

Re: Enter Trade with managing function - 12/15/12 08:58

Hmmm ok Ive been looking through charts and it seems that my script is not executing any trades on a Friday and since I ran this script for the first time on Friday it now makes more sense why trades didnt execute even though my rules said they should of. But also looking through the backtest it seems there is no trades on Fridays there either so I obviously have a problem somewhere in my script, will try playing with it now Ive atleast narrowed it down a bit might not be my trade management function afterall.
Posted By: Spirit

Re: Enter Trade with managing function - 12/16/12 10:43

I can execute trades on Friday with my own script, maybe you opened trades too late? I think the weekend begins Friday 20:00 and there is no trading during the weekend.
Posted By: TankWolf

Re: Enter Trade with managing function - 12/16/12 11:26

I worked out what was wrong and have everything backtesting correctly will report back on Monday when I test the script to ensure my trade management function is fine.
Posted By: TankWolf

Re: Enter Trade with managing function - 12/17/12 08:50

Well so far doesnt seem to be opening any positions when it should, my backtest works perfectly and the chart results show the right trades at the right places even entering during H1 bars yet in live trading the script is not opening any trades. Suggestions?
Posted By: jcl

Re: Enter Trade with managing function - 12/17/12 10:19

There can be many reasons, dependent on your script and settings. If Zorro does not open a trade, you'll see an error message in the window and can normally determine the reason of the problem.

You can also click on [Result] while life trading - you'll then see a chart with all plots so far. This way you can verify if and when indicators have crossed or a signal has been triggered. Or you can print a messages in your script when a signal occurs, and can then see what's happening.

If you can't find the reason yourself, just post that system here - or send it me by PM when it's secret - and I'll look into it.
Posted By: TankWolf

Re: Enter Trade with managing function - 12/17/12 10:28

Not getting any error messages just no trades triggering. The only other thing I thought might be wrong was this line.

Quote:

enterLong(0,Entry,Stop,TakeProfit);


Should I use 1 instead of 0 for lots maybe? If thats not the cause I'll send you a copy so you can take a look.
Posted By: jcl

Re: Enter Trade with managing function - 12/17/12 11:04

0 is ok unless you've set also the external Lots variable explicitely to 0.

Your line above does not open trades when Entry was not met within the next bar. Then you'll get no error message of course, as this is no error. So I'd check the Entry value. If you can't find the problem you can anytime send me the script.

© 2024 lite-C Forums