CanOz
Home runs feel good, but base hits pay bills!
- Joined
- 11 July 2006
- Posts
- 11,543
- Reactions
- 519
//ATR Crossover woth SMA cross trailing stop_use on daily TF_by CanOz
if marketposition <1 and AvgTrueRange(20) crosses above AvgTrueRange(100) then sell short this bar;
If marketposition = 1 and average(c,25) crosses above average (c,15)then buy to cover this bar;
If marketposition<1 and AvgTrueRange(20) crosses below AvgTrueRange(100) then buy this bar;
If marketposition = 1 and average(c,25) crosses below average (c,15) then sell this bar;
Gee whiz I spent much time into the early hours of mornings running mechanical systems on Amibroker and found nothing that gave me real money similar results or confidence to put real money on (since I lost a fair bit on the learning treadmill anyway). The overall market conditions, bad news announcement, a glitch here, a stall there, stopped out on desperate large parcel offloads, missed exits because system said hold and generally different from backtest results. I felt I knew way more than a mechanical system so I stopped and collated all what I have learned and make "decisions" from a variety of set ups (not restricted there) with "consideration" of way more market nuances than my mechanical systems can see. Market depth, short positions open, market sentiment and all the little experiences picked up along the way for example.2.) If you have 'been there, done that' then please let us work through some of the issues so we get a feel of ownership. Maybe a few hints now and then would be good too.
Gee whiz I spent much time into the early hours of mornings running mechanical systems on Amibroker and found nothing that gave me real money similar results or confidence to put real money on (since I lost a fair bit on the learning treadmill anyway). The overall market conditions, bad news announcement, a glitch here, a stall there, stopped out on desperate large parcel offloads, missed exits because system said hold and generally different from backtest results. I felt I knew way more than a mechanical system so I stopped and collated all what I have learned and make "decisions" from a variety of set ups (not restricted there) with "consideration" of way more market nuances than my mechanical systems can see. Market depth, short positions open, market sentiment and all the little experiences picked up along the way for example.
Still use the charts but fixed rules did not work for me. I know I am not alone.
Kicking myself for not learning to code years ago, i could have been a gun by now!
//*************************************Thirty-Ten Breakout************************************************
//************30m10bar breakout strategy for GC by CanOz************
///////////////////Created September 2017////////////////////////////
//This strategy enters the market on a break of the 10 bar high or low and uses a
//trailing stop after an inital stop loss.
//These inouts can be optimised, Bars before break, start time and end time, Long and short stops and the ATR %
//Filter and threshold
Inputs:BBS(15),starttime(300), endtime(830), SLLE(1300),SLSE(350), Length( 30),Threshold( .5),
//Long entry ATR Trail stop settings, also optimisable
ATRLengthLE( 2) ,
NumATRsLE( 2) ,
NumBarsLE( 9),
//Short entry ATR Trail stop settings
ATRLengthSE( 2) ,
NumATRsSE( 4) ,
NumBarsSE( 5) ;
//Filters//////////////////////////////////////////////
//Regime Filter - stays out of extreme low volatility
Condition1 = (AvgTrueRange( Length ) / Close * 100)data2>Threshold;
//Trading time Filter - only trade the first three hours of the European session
Condition2 = time is >=starttime and time is <=endtime;
///////////////////////////////////////////////////////
//Bull_Bear Filter - you can try using this one by uncommenting and cutting in the conditions
//Condition3 = the c[1]data2 > average(c,100)data2;
//condition4 = the c[1]data2 < average(c,100)data2;
variables:
MaxN_ATR(0) ,
MP( 0 ),
TT( 0 ),
TargetPrice( 0 );
MP = MarketPosition;
TT = TotalTrades;
If condition1 then begin;
//Long Entry
If MP <1 and Condition2 then buy next bar at highest(h,BBS) stop;
//Initial Stop Loss
Setstoploss(SLLE);
//Exit before the close
Setexitonclose;
//Short Entry
If MP > -1 and Condition2 then sell short next bar at lowest(l,BBS) stop;
//Initial Stop Loss
SetStoploss(SLSE);
//Exit before the close
Setexitonclose;
//Trailing Stop
if MP = 1 then
begin
if TT <> TT[1] or MP[1] <> 1 then
TargetPrice = EntryPrice + AvgTrueRange( ATRLengthLE )data3 * NumATRsLE;
if BarsSinceEntry < NumBarsLE then
Sell ( !( "ATTLX-Tgt" ) ) next bar at TargetPrice limit
else
Sell ( !( "ATTLX-Trl" ) ) next bar at Low stop;
end;
if MP = -1 then
begin
if TT <> TT[1] or MP[1] <> -1 then
TargetPrice = EntryPrice - AvgTrueRange( ATRLengthSE )data3 * NumATRsSE;
if BarsSinceEntry < NumBarsSE then
Buy To Cover ( !( "ATTSX-Tgt" ) ) next bar at TargetPrice limit
else
Buy To Cover ( !( "ATTSX-Trl" ) ) next bar at High stop;
end;
end;
////////////////////Enjoy!////////////////////////////////////////////////////////
Hello and welcome to Aussie Stock Forums!
To gain full access you must register. Registration is free and takes only a few seconds to complete.
Already a member? Log in here.