AW: RND - Rounding function doesn't work properly

I attached one strategy with 2 different settings. This strategy is written in AlgoWizard. Round function is used for rounding lots (0.0X). But If you look at List of trades there is one extremely big trade with huge volume. So I think, that there is some error in calculation and rounding. Please, could you check where it? 

Tested on GBPUSD M15, 1 min precison
Attachments
Rounding_error_NOK.sqx
(1.43 MiB)
Rounding_error_OK.sqx
(1.37 MiB)
  • Votes 0
  • Project StrategyQuant X
  • Type Bug
  • Status Refused
  • Priority Normal

History

BS
#1

BobS

07.06.2021 16:28

Task created

MF
#2

Mark Fric

08.06.2021 13:14

Status changed from New to Waiting for information

I don't understand the attached strategies - they have different backtest results, but they are the same - both use Round.


How did you get different results for them?


I also noticed that the backtests of these strategies is very slow, the problem is in MarketPositionsCount() - this function is slow, and you call it in almost every tab.

It would be much faster to call it just once, store its value to a variable and then compare the variable in all the other tabs.

BS
#3

BobS

08.06.2021 13:24
It is one strategy, and only two values (PT_money and Lot_nasobic) are different. But I think, that if you will retest it on another Data range, this problem with huge Lot will occures on both strategies but at different date.

So the main point is, that Rounding function probably doesn't work properly and stable.

Thanks for advice, I will change it. 
MF
#4

Mark Fric

08.06.2021 13:42

Attachment Rounding_error_OK_Optim.sqx added

Rounding_error_OK_Optim.sqx
(9.62 KiB)
I'm attaching the optimized strategy. 


I confirm that there are some problems, I'll look at it.

MF
#5

Mark Fric

08.06.2021 14:07

Status changed from Waiting for information to Refused

Attachment Rounding_error_OK_Optim2.sqx added

Rounding_error_OK_Optim2.sqx
(9.30 KiB)
I'm attaching further optimized strategy - the rules are evaluated on bar open, not on every tick. I'm not sure if you needed to evaluate them on every tick.


I found the problem with your strategy - there is no maximum limit to which the Lot variable can grow.

You multiply it with Lot_nasobic in tab Loty, and this is called over and over repeatedly, and Lot variable keeps on growing. 

I see that the trades are opening with size of millions of lots.


You probably have to put some maximum there.

BS
#6

BobS

08.06.2021 14:24
Thanks, I will look at it. Yes, I need it evaluate it on every tick. 

Action on Tab Loty is triggered only, when conditions are true, and it should be only in 1 tick. On another tick is pending order placed and these conditions are false. 

I will let you know.
BS
#7

BobS

09.06.2021 12:35

Attachment Rounding_error_Bar_open_light.sqx added

Rounding_error_Bar_open_light.sqx
(43.22 KiB)
I simplified strategy, used On Bar open tabs. But I noticed, that there is problem in placing new orders. New order is placed (and also new lot volume calculated) , when one of two pending order doesn't exists.  Trade volume is multiplied every bar and then after 2 days is trade volume huge.

Retest in MT4 is ok. In SQX not
BS
#8

BobS

11.06.2021 07:02
OK, I got it finally. This strategy uses grid, and when there is bar which in 1 minute makes bigger movement than grid distance, SQX does not open pending order. Lot volume is multipied every tick. 

I need to rearrange strategy. But tick simulation would be also fine in SQX :-)

Thanks for help, Mark

Votes: 0

Drop files to upload

or

choose files

Max size: 5MB

Not allowed: exe, msi, application, reg, php, js, htaccess, htpasswd, gitignore

...
Wait please