pivot system
Anyway, let's get back to the system. I will now need to simplify it as much as possible.
Ok, done. I've clarified it as much as I could and here's where I stand before optimization:
Code:
Inputs: test(0), test2(0), test3(0);
variables: Pivot(0), Res1(0), Sup1(0), nearness(0), bracket(0), average_value(0);
Pivot = (HighD(1) + LowD(1) + CloseD(1))/3;
Res1 = 2 * Pivot - LowD(1);
Sup1 = 2 * Pivot - HighD(1);
[COLOR="Red"]these are the 3 values I will want to optimize out curiosity but my bet is this:[/COLOR]
nearness = test; [COLOR="red"]optimal values should be around 0.0030 ticks[/COLOR]
bracket = 0.0040; [COLOR="red"]I'll optimize these later: these are my roughly estimated optimal values[/COLOR]
average_value = 9;
If marketposition = 0 and date>=1100726
and ((low <= Sup1 + nearness and lowd(0) >= Sup1 - nearness) or (low <= Pivot+ nearness and lowd(0) >= Pivot - nearness))
and low < AverageFC(c, average_value)
and lowd(0) > lowd(1)
Then begin
buy("Long") this Bar;
Print(File("E:\downloads\financial_software\tradestation\EURO\mydata.txt"), date:0:0," ", time:4:0,
" H:", HighD(1):4:4, " L:", LowD(1):4:4, " C:", CloseD(1):4:4, " S1, P, R1", Sup1:4:4, Pivot:4:4, Res1:4:4, " low: ", low:4:4);
end;
If c < AverageFC(c, average_value) and (openpositionprofit > bracket or openpositionprofit < -bracket) then exitlong ("bracket exit") this bar;
Here's the report right now:
It trades about once a day, and that is why I say that out of 2 weeks we should be having profit each time.
Now I will optimize everything and see if it makes sense. No, first I need once again to see if it does exactly what I want it to do, trade by trade, 15 trades in all.
Wow!
Without even optimizing i found an amazing code: by setting the nearness to just 15 ticks, results improve greatly. I think this system could be used as well for short entries, simply by reversing entries, but for now I will focus on long trades.
Another thing to mention is that I totally took time of the day out of the picture and it's a good thing, so now the only thing working for me is pivots and I am not polluting my edge, if there is one.
The new improved code is like above but has this difference:
The report is like this:
We're getting close to the point where I will not want to show my code anymore. But I still do it because it helps me work.
RUNNING OPTIMIZATIONS
NEARNESS: estimated 0.0030, optimized 0.0020
I ran my first optimization, which matches my intuition: it turns out that 0.0020 as nearness does a bit better, and since it's a round number and not over-optimized because it is a peak on a plateau, I will keep it. I don't think I'll be using fractions of the price, because I want to have it very clear in my mind what the nearness allowed is, and also because currencies, unlike stock indexes, don't need this endogenous variables type of stuff, since they just go up and down.
BRACKET: estimated 0.0040, optimized 0.0040
What can I add to the above? Great success.
MOVING AVERAGE: estimated 9, optimized ?????
Ok, here I started changing things so we'll have to move to the next post or it'll get too complex in only one post. We need two different types of exits and two different moving averages as well.
We need stoploss to be independent from traling stop. We need the stoploss moving average to be different - if it works better- from the entry moving average. (see next post).
AUTOMATION PROBLEM (SOLVED)
Just now I was in the shower and it came to me. I came to realize that if I don't automate this crap, it won't be any good. And I can only automate things if they don't need continuous moving averages. So - if I want to automate this on excel - I need to find a way to either:
1) close before the end of the session (I'll have to see how well it does on tests)
2) exit without using the moving average (possibly a time exit)
Oh yes!!! I added this code and actually both Return On Account increased with the other performances values decreasing almost nothing:
If time >= 2300 then exitlong ("time exit") this bar;
It's a very good thing by all points of view that I don't have to stay LONG overnight, nor beyond the session. But I want to optimize this value as well and see what happens. Right now the value used is 23.00, which is the close of New York, at 22.00 CET, 16.00 EST, 15.00 CST...
Oh yeah! I checked out a whole lot of value and it turns out that the longer it runs, the better. But it seems pretty good to close exactly as the overnight margin resumes (this way I will save on margin as well), which is 20.45 CET:
If time >= 2145 then exitlong ("time exit") this bar;
Here's the amazing profit it makes this way:
Hell no. I'll keep the position open until as late as possible before the end of the session, because I really want to measure the pivots' edge rather than polluting it with other things. I will even get rid of this line in future testing. This last line needs to be optimized on many weeks and only if and when I automate the system. Now i'll get rid of it so it doesn't pollute my pivots' edge.