Gamestudio Links
Zorro Links
Newest Posts
Data from CSV not parsed correctly
by EternallyCurious. 04/18/24 10:45
StartWeek not working as it should
by Zheka. 04/18/24 10:11
folder management functions
by VoroneTZ. 04/17/24 06:52
lookback setting performance issue
by 7th_zorro. 04/16/24 03:08
zorro 64bit command line support
by 7th_zorro. 04/15/24 09:36
Zorro FIX plugin - Experimental
by flink. 04/14/24 07:48
Zorro FIX plugin - Experimental
by flink. 04/14/24 07:46
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
4 registered members (7th_zorro, Quad, VoroneTZ, 1 invisible), 623 guests, and 2 spiders.
Key: Admin, Global Mod, Mod
Newest Members
EternallyCurious, 11honza11, ccorrea, sakolin, rajesh7827
19046 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
priceClose() - How to use actual bar close in live trading? #465429
04/27/17 07:34
04/27/17 07:34
Joined: Aug 2016
Posts: 27
M
MaskOfZorro Offline OP
Newbie
MaskOfZorro  Offline OP
Newbie
M

Joined: Aug 2016
Posts: 27
priceClose() used in a TMF returns the last tick, but my backtests are using 1-minute bar data, not tick data.

This means when trading live, if I have a trading rule like if(crossUnder(Price,low)) ... where vars Price = series(priceClose()) and low is some threshold, it's triggering trades on the tick at any time, whereas in the backtest it's only triggering trades if the closing price of the 1m bar meets the criterion. This creates a big discrepancy between what the live trading is doing and what the backtesst is doing, no?

How do I replicate the backtest way in live trading? i.e., I want this rule to trigger only on the actual close of the bar if that price has crossed the threhold. i want it to work on bar data, not tick data.

Last edited by MaskOfZorro; 04/27/17 07:35.
Re: priceClose() - How to use actual bar close in live trading? [Re: MaskOfZorro] #465433
04/27/17 12:10
04/27/17 12:10
Joined: Jul 2000
Posts: 27,978
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,978
Frankfurt
If you use the price of the current tick in a TMF, you must indeed backtest with T1 data. But if you use only the close of the current bar, M1 data is sufficient - at least I would not know a reason of a "discrepancy".

Re: priceClose() - How to use actual bar close in live trading? [Re: jcl] #465439
04/27/17 14:24
04/27/17 14:24
Joined: Aug 2016
Posts: 27
M
MaskOfZorro Offline OP
Newbie
MaskOfZorro  Offline OP
Newbie
M

Joined: Aug 2016
Posts: 27
Originally Posted By: jcl
If you use the price of the current tick in a TMF, you must indeed backtest with T1 data. But if you use only the close of the current bar, M1 data is sufficient - at least I would not know a reason of a "discrepancy".


But how do I get the close of the current bar in live trading? It's a price feed coming through metatrader and it's changing tick-by-tick. How do I do this M1? priceClose() gives me the latest price and it's giving trade signals mid-bar - I don't want that. e.g. If the close at 15:00 is below the theshold and the close at 15:01 above, then enter the trade. I don't want trades going off in the middle of the bar at the exact tick that the crossover happens - I want to wait until the close of the bar and if it's still over, trade - if it's slipped back under, don't.

Re: priceClose() - How to use actual bar close in live trading? [Re: MaskOfZorro] #465443
04/27/17 16:50
04/27/17 16:50
Joined: Jul 2000
Posts: 27,978
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,978
Frankfurt
priceClose() is no feed from metatrader, but simply the close price of the recent bar. You won't enter trades in the middle of a bar unless you do that intentionally, for instance by using a TMF or entry limit.


Moderated by  Petra 

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

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

Powered by UBB.threads™ PHP Forum Software 7.7.1