Weird spikes on GRAPH results with MTF
Forums › ProRealTime English forum › ProOrder support › Weird spikes on GRAPH results with MTF
- This topic has 15 replies, 3 voices, and was last updated 6 years ago by
Vonasi.
-
-
08/01/2019 at 5:33 PM #103988
I’m messing around with a long only MTF strategy that makes all its decisions and has all the code on the monthly and weekly time frames but trades on the daily chart but there is no code under a daily timeframe. This is purely to allow it to trade as one day divides into a week and divides into a month but a week does not divide into a month – Yes MTF confuses me sometimes too!
I have an IF THEN condition which if it is met sells everything and within this same IF THEN I add one to a variable just so that I can graph the variable and see how many times the condition led to trades being closed. Nothing ever subtracts from the variable but when I GRAPH it I get the weird spikes shown in the image.
08/01/2019 at 7:23 PM #103990a week does not divide into a month – Yes MTF confuses me sometimes too!
It doesn’t thought does it, but you know that so you must mean something different than I read?
08/01/2019 at 8:30 PM #10399208/01/2019 at 8:32 PM #103993What I don’t get is if I am just using month and week time frames then I can only open and close trades on the first candle of a week so what difference does it make that a week does not divide into a month? If I am looking at indicator values either on the fly during the month or at the end of the week it is the same thing as I can only look at them at the end of the week as I only have two time frames.
Anyway this is a little off topic – it was the spikes that was bugging me more as I can’t trust the results of the graph that is shown.
08/01/2019 at 9:05 PM #103996to search for to find your code
Aha it was Nicolas code, but I was sure you did one also?
‘Simulated trades’ is the keyword anyway …. found the code via google.
08/02/2019 at 7:46 AM #10401108/02/2019 at 8:19 AM #104015There is no date conditions in the code at all. It simply looks for the low to be above a value on the monthly timeframe and then on the weekly timeframe checks for a down week and buys at the end of the week on a daily chart. There are two exit conditions both on the weekly chart and both contained within their own IF THEN ENDIF’s. There is never anything deducted from the ex variable so I don’t understand the spikes. The code is something like this:
123456789101112131415161718192021222324timeframe(monthly, updateonclose)mflag = 0if (my condition1) thenmflag = 1timeframe(weekly)wflag = 0if close < open thenwflag = 1if wflag and mflag thenbuy 1 contract at marketendifif onmarket and (my exit condition1) thensell at marketendifif onmarket and (my exit conditions) thensell at marketex = ex + 1endifgraph ex08/02/2019 at 8:24 AM #10401608/02/2019 at 10:21 AM #10402008/02/2019 at 10:24 AM #10402108/02/2019 at 11:08 AM #104031I still can’t understand how the ‘ex’ variable can decrease!
This is why I posted it! It’s a weird MTF bug! As I’m only using it to count how many times a condition occurs and to graph that it is not so important but if it was a variable that I used in the code for decision making then that is a little more important.
The first image is with DEFAULT and the second is with UPDATEONCLOSE. The value is different throughout except when it spikes.
08/02/2019 at 11:11 AM #10403408/02/2019 at 12:15 PM #10404008/02/2019 at 12:25 PM #104041It seems pretty random. The last spike was on a Wednesday when selling can only occur on a Monday.
I even tried this to see if it was an issue with two exit conditions being true at the same time but it makes no difference:
123456789101112131415if onmarket and (exit condition1) thenflag = 1ex = ex + 1endifif onmarket and (exit condition2) thenflag = 1endifif flag = 1 thensell at marketflag = 0endifgraph ex08/02/2019 at 2:50 PM #104055 -
AuthorPosts
Find exclusive trading pro-tools on