NotesWhat is notes.io?

Notes brand slogan

Notes - notes.io

_SECTION_BEGIN("Turtle System ");
// Turtle minor and major trading signals - for AmiBroker - Use at your own risk
// CAUTION: Thrtles was originally designed to trade futures. Using it with stocks might pose many problems.
// Be sure to back test and optimize this with any stock you might use it with AND back test again.

// NOTE: This is a rudimentary implementation as it does not include the following:
// volitality share sizing
// stops
// Trade selection which only trades following a theoretical

// Two default periods are used 20/10 for short term trading and 65/30 for long term trading
// Try to optomize these valuess but be careful not curve fit. It must work across many stocks, etc. OR it is curve fitted.

// constants account = 5000.00; // set this to whatever you want to use per trade
tradeCount = 0;
price = 0.0;

PeriodSys1Buy = Param("Short bar entry", 20, 1, 100, 1);
// number of bars back to look for a short term buy breakvaout
PeriodSys1Sel1 = Param("Short bar exit", 10, 1, 100, 1);
// number of bars back to look for a sell
PeriodSys2Buy = Param("Long bar entry", 65, 1, 100, 1); // number of bars back to look for a long Buy breakvaout
PeriodSys2Sel1 = Param("Long bar exit", 30, 1, 100, 1); // number of bars back to look for a Sell

buyRangeSys1 = HHV(H, PeriodSys1Buy ); // buy or Short range for system 1
sellRangeSys1 = LLV(L, PeriodSys1Sel1 ); // Sell OR Cover range for system 1
shortRangeSys1 = LLV(L, Periodsys1Buy ); // Buy OR Short range for system 2
coverRangeSys1 = HHV(H, PeriodSys1Sel1 ); // Sell OR Cover range for system 2

// #####################
// System 1 rules
// #####################

// if the market sets a new system 1 day high then buy
myBuySys1 = IIf(C > Ref(buyRangeSys1, -1), 1, 0); // if todays Close is >= that the Highest value set Buy Signal
mySellSys1 = IIf(C < Ref(sellRangeSys1, -1), 1, 0); // if todays Close is <= that the Lowest value set Sell Signal
Sys1Buy = ExRem(myBuySys1 ,mySellSys1 ); // remove all the other buy signals from buy to Sell - only take one position
Sys1Sell = ExRem(mySellSys1 ,myBuySys1 ); // remove all the other Sell signals from Sell to Buy - only take one position

// short
myShortSys1 = IIf(C < Ref(shortRangeSys1, -1), 1, 0); // if todays Close is >= that the Highest value set Buy Signal
myCoverSys1 = IIf(C > Ref(coverRangeSys1, -1), 1, 0); // if todays Close is <= that the Lowest value set Sell Signal
Sys1Short = ExRem(myShortSys1 ,myCoverSys1 ); // remove all the other short signals from buy to Sell -only take one position
Sys1Cover = ExRem(myCoverSys1 ,myShortSys1 ); // remove all the other Cover signals from Sell to Buy -only take one position

// #####################
// System 2 rules
// #####################

buyRangeSys2 = HHV(H, PeriodSys2Buy ); // buy or Short range for system 1
sellRangeSys2 = LLV(L, PeriodSys2Sel1 ); // Sell OR Cover range for system 1
shortRangeSys2 = LLV(L, PeriodSys2Buy ); // Buy OR Short range for system 2
coverRangeSys2 = HHV(H, PeriodSys2Sel1 ); // Sell OR Cover range for system 2

// if the market sets a new system 1 day high then buy
myBuySys2 = IIf(C > Ref(buyRangeSys2, -1), 1, 0);
// if todays close is >= that the highest value set buy Signal
mySellSys2 = IIf(C < Ref(sellRangeSys2, -1), 1, 0); // if todays Close is <= that the Lowest value set Sell Signal
Sys2Buy = ExRem(myBuySys2 ,mySellSys2 ); // remove all the other buy signals from buy to Sell - only take one position
Sys2Sell = ExRem(mySellSys2 ,myBuySys2 ); // remove all the other sell signals from sell to Buy - only take one position

// short
myShortSys2 = IIf(C < Ref(shortRangeSys2, -1), 1, 0); // if todays Close is >= that the Highest value set Buy Signal
myCoverSys2 = IIf(C > Ref(coverRangeSys2, -1), 1, 0); // if todays Close is <= that the Lowest value set Sell Signal
Sys2Short = ExRem(myShortSys2 ,myCoverSys2 ); // remove all the other short signals from buy to sell - only take one position
Sys2Cover = ExRem(myCoverSys2 ,myShortSys2 ); // remove all the other Cover signals from Sell to Buy - only take one position

// #####################
// Combining the rules
// #####################

Buy = Sys1Buy OR Sys2Buy;
Sell = Sys1Sell OR Sys2Sell;
Short = Sys1Short OR Sys2Short;
Cover = Sys1Cover OR Sys2Cover;

// #####################
// Plotting the results
// #####################

// System 1 trades
Plot(Sys1Buy * C / 2, "Turtles - Sys1 Green = Buy", colorGreen);
Plot(-Sys1Sell * C / 2, "Blue = Sys1 Sell", colorBlue);
Plot(-Sys1Short * C / 2, "Red = Sys1 Short", colorRed);
Plot(Sys1Cover * C / 2, "Black = Sys1 Cover", colorBlack);

// System 2 trades
Plot(Sys2Buy * C, "n Sys 2 - Green = Buy", colorGreen,
styleDashed );
Plot(-Sys2Sell * C, "Sys 2 Blue = Sell", colorBlue, styleDashed );
Plot(-Sys2Short * C, "Sys 2 Red = Short", colorRed, styleDashed );
Plot(Sys2Cover * C, "Sys 2 Black = Cover", colorBlack, styleDashed );

Filter = Sys1Buy OR Sys1Sell OR Sys1Short OR Sys1Cover OR Sys2Buy OR
Sys2Sell OR Sys2Short OR Sys2Cover ; // used for scan function
AddColumn(Sys1Buy , "Sys 1 Buy");
AddColumn(Sys1Sell , "Sys 1 Sell");
AddColumn(Sys1Short , "Sys 1 Short");
AddColumn(Sys1Cover , "Sys 1 Cover");

AddColumn(Sys2Buy , "Sys 2 Buy");
AddColumn(Sys2Sell , "Sys 2 Sell");
AddColumn(Sys2Short , "Sys 2 Short");
AddColumn(Sys2Cover , "Sys 2 Cover");
_SECTION_END();Write a note in this area. It's really easy to share with others. Click here ...
     
 
what is notes.io
 

Notes.io is a web-based application for taking notes. You can take your notes and share with others people. If you like taking long notes, notes.io is designed for you. To date, over 8,000,000,000 notes created and continuing...

With notes.io;

  • * You can take a note from anywhere and any device with internet connection.
  • * You can share the notes in social platforms (YouTube, Facebook, Twitter, instagram etc.).
  • * You can quickly share your contents without website, blog and e-mail.
  • * You don't need to create any Account to share a note. As you wish you can use quick, easy and best shortened notes with sms, websites, e-mail, or messaging services (WhatsApp, iMessage, Telegram, Signal).
  • * Notes.io has fabulous infrastructure design for a short link and allows you to share the note as an easy and understandable link.

Fast: Notes.io is built for speed and performance. You can take a notes quickly and browse your archive.

Easy: Notes.io doesn’t require installation. Just write and share note!

Short: Notes.io’s url just 8 character. You’ll get shorten link of your note when you want to share. (Ex: notes.io/q )

Free: Notes.io works for 12 years and has been free since the day it was started.


You immediately create your first note and start sharing with the ones you wish. If you want to contact us, you can use the following communication channels;


Email: [email protected]

Twitter: http://twitter.com/notesio

Instagram: http://instagram.com/notes.io

Facebook: http://facebook.com/notesio



Regards;
Notes.io Team

     
 
Shortened Note Link
 
 
Looding Image
 
     
 
Long File
 
 

For written notes was greater than 18KB Unable to shorten.

To be smaller than 18KB, please organize your notes, or sign in.