Prior Day MidPoint Strategy

trading strategies and money management discussion, code, results

Moderator: moderators

jstockman
rank: 50+ posts
rank: 50+ posts
Posts: 142
Joined: Fri Jun 09, 2006 2:43 pm
Reputation: 0
Gender: Male

Prior Day MidPoint Strategy

Postby jstockman » Thu Jun 29, 2006 8:54 pm

I need some help. I don't have a programmer background, but learning. I am trading 5 min ES and want to use the same concept that TRO uses but go long or short if current days price exceeds prior day's midpoint. This is ts code.


This does not generate any trades. Can't see error in logic.

I need help.

Here is my code

Code: Select all

{Takeoff of TRO Trillion Dollar Forex strategy. Goes long or short when the prior day mid point is broken. 
broken}

Input: iMaxDollarLoss(300), 
   iTarget(125),       
   Stime (0630),   
   ETime (1315),   
   MaxTradesPerDay(1);   

vars:  pMidpoint(0), MaxTrades (0);


Condition1 = EntriesToday (Date) < MaxTradesPerDay;  // limit max trades per day.
pMidpoint = (HighD (1) + LowD (1)) * .50;   //Previoue day midpoint

if currentbar > 1 and time = STime and Condition1 then begin
   If high >  pMidpoint then Buy next bar at market;    // enter buy at the previous midpoint
end;

if currentbar > 1 and time = STime and Condition1 then begin   
   If low = pMidpoint then SellShort next bar at market;   // enter sell at the previous day's midpoint
end;

SetStopPosition;

SetProfitTarget (iTarget);

SetStopLoss (iMaxDollarLoss);

SetExitOnClose;


[schild=6 fontcolor=000000 shadowcolor=C0C0C0 shieldshadow=1]I need help[/schild]

Please add www.kreslik.com to your ad blocker white list.
Thank you for your support.

User avatar
blr121970
rank: <50 posts
rank: <50 posts
Posts: 23
Joined: Mon May 22, 2006 1:55 am
Reputation: 0
Location: Irvine, California
Gender: Male

Postby blr121970 » Thu Jun 29, 2006 10:06 pm

After taking just a cursory glance I would suggest you get rid of the

and time = STime

condition.

jstockman
rank: 50+ posts
rank: 50+ posts
Posts: 142
Joined: Fri Jun 09, 2006 2:43 pm
Reputation: 0
Gender: Male

Time Start Deleted

Postby jstockman » Sat Jul 01, 2006 7:29 am

blr121970

I did as you suggested and I am now getting trades. I have posted code.


Code: Select all

{Takeoff of TRO Trillion Dollar Forex strategy. Goes long or short when the prior day mid point is broken. 
broken}

Input: iMaxDollarLoss(300),  // IN DOLLARS
   iTarget(125),         // IN DOLLARS
   MaxTradesPerDay(1);     // Limit Trades Per Day

vars:  pMidpoint(0), MaxTrades (0);


Condition1 = EntriesToday (Date) < MaxTradesPerDay;  // limit max trades per day.
pMidpoint = (HighD (1) + LowD (1)) * .50;   //Previoue day midpoint

if currentbar > 1 and Condition1 then begin
   If high >  pMidpoint then Buy next bar at market;    // enter buy at the previous midpoint
end;

if currentbar > 1 {and time = STime} and Condition1 then begin   
   If low = pMidpoint then SellShort next bar at market;   // enter sell at the previous day's midpoint
end;

SetStopPosition;

SetProfitTarget (iTarget);

SetStopLoss (iMaxDollarLoss);

SetExitOnClose;


I don't know how to show you performance reports. What I want to do is make a high percentage profitable and net at least 100 per day.

That is occuring but with no slippage or commission.

I am using ES 1 min. charts.

What type of slippage and commiss. do you use in your back tests.


Jimmyj

Ali Son
rank: 150+ posts
rank: 150+ posts
Posts: 179
Joined: Sun May 28, 2006 1:30 am
Reputation: 0
Location: Boston, MA
Gender: None specified

Postby Ali Son » Wed Jul 05, 2006 12:42 am

Jstockman,

Any lucky making that strat work with the appropriate commission/slippage? If so, what commission/slippage did you use? Best to use the most severe? (Check TS search feature forums for guidelines and pitfalls from some pro auomated traders like Nemo and Mathemagician.) Perhaps you're already having success.

JPT
rank: <50 posts
rank: <50 posts
Posts: 49
Joined: Mon May 22, 2006 3:26 pm
Reputation: 0
Location: Monterey, CA USA
Gender: None specified

Postby JPT » Wed Jul 05, 2006 5:00 am

On the ER2 you should use $10 per side per trade for commissions + slippage. What usually happens is that you get hit for one tick on one side if automated and not on the other.

I have found that for automated trading, 10 per side works great and in reality it very much tracks actual trading. Actually about 25% more conservative. Of course this is with only up to 7 contracts traded any one way with 14 contracts total on a switch.

Please add www.kreslik.com to your ad blocker white list.
Thank you for your support.

jstockman
rank: 50+ posts
rank: 50+ posts
Posts: 142
Joined: Fri Jun 09, 2006 2:43 pm
Reputation: 0
Gender: Male

Thnak=you

Postby jstockman » Thu Jul 06, 2006 2:32 pm

Thank-you for your help.

Learning how to program is like being a child again. You speak in fragments. ha ha !

Thank-you for all your help guys

Jimmyj

jstockman
rank: 50+ posts
rank: 50+ posts
Posts: 142
Joined: Fri Jun 09, 2006 2:43 pm
Reputation: 0
Gender: Male

Slipage

Postby jstockman » Fri Jul 07, 2006 3:19 pm

Ali Son

I put in 10.00 per trade/contract. It killed me. Back to the drawing board.

Jimmyj

JPT
rank: <50 posts
rank: <50 posts
Posts: 49
Joined: Mon May 22, 2006 3:26 pm
Reputation: 0
Location: Monterey, CA USA
Gender: None specified

Postby JPT » Fri Jul 07, 2006 11:56 pm

Don't feel dicouraged. It happens to me all the time. That is why I never run a test, even when I start developing a strategy without 10 per side for slippage. If it works there, then it will work in real life. One other item. If you use % trailing stops you must use the inside bar testing check box. If you use a 5 min chart, you are best to use a 1 min granulation. I can take a great looking strategy and turn it to dust just by checking that box.

The theory is, TS in backtesting, only checks the open, high, low and close. In reality, the ticks don't come in that one preceise order, so sometimes you get the fill you want and in reality you would not get it. Very confusing. I also never do studies with out at least a 1min granularity for the back testing. Then you, at least have a chance.

Of course, if you write your own code for stop losses and trailing stops and only execute the stop at the open of the next bar, then you would not need to worry about this granularity.

Hope this helps

jstockman
rank: 50+ posts
rank: 50+ posts
Posts: 142
Joined: Fri Jun 09, 2006 2:43 pm
Reputation: 0
Gender: Male

Postby jstockman » Sat Jul 08, 2006 6:33 pm

Thank-you for the advise. I really appreciate it.

Jimmyj


JPT wrote:Don't feel dicouraged. It happens to me all the time. That is why I never run a test, even when I start developing a strategy without 10 per side for slippage. If it works there, then it will work in real life. One other item. If you use % trailing stops you must use the inside bar testing check box. If you use a 5 min chart, you are best to use a 1 min granulation. I can take a great looking strategy and turn it to dust just by checking that box.

The theory is, TS in backtesting, only checks the open, high, low and close. In reality, the ticks don't come in that one preceise order, so sometimes you get the fill you want and in reality you would not get it. Very confusing. I also never do studies with out at least a 1min granularity for the back testing. Then you, at least have a chance.

Of course, if you write your own code for stop losses and trailing stops and only execute the stop at the open of the next bar, then you would not need to worry about this granularity.

Hope this helps

Ali Son
rank: 150+ posts
rank: 150+ posts
Posts: 179
Joined: Sun May 28, 2006 1:30 am
Reputation: 0
Location: Boston, MA
Gender: None specified

Postby Ali Son » Sun Jul 09, 2006 11:06 am

Yes, I found this Percentrailing stop is a BIG concern for Bacctesting with Look-Inside-The Bar Testing.

BUT JPT, so to clarify, it'sNOT only % tailing stops that one must use the look-inside-bar testing, RIGHT?? I am just asking. SO, ALL types of stops are apllicable unless they are custom designed stops that specify that it wants preceisely the open, high, low or close for backtesting?

And, if stops aren't used, just buy and sell orders, LIB should still be checked off, yes?

Also, to clarify once and for all, WHAT timeframes does Look-Inside-Bar Testing NOT a concern for; in other words, is this a concern equally for 1 iminute charts as it is for daily charts?

Finally, let's say one is doing walk-forward testing by papertrading the strat forward for one year, one still must still check the L-I-B testing?


Thanks in advance.
-OS

Please add www.kreslik.com to your ad blocker white list.
Thank you for your support.


Return to “strategy trading & money management”