├── Statistic
├── README.md
└── Example.xlsx
├── .gitattributes
├── Tutorial
├── README.md
├── AgenaTraderDLL
│ └── README.md
├── Connect_GitHub_with_AgenaTrader
│ └── README.md
└── Example_Indicator_Condition_Strategy
│ ├── README.md
│ ├── Example_Indicator_Condition_Strategy.md
│ └── Example_Indicator_Condition_Strategy_Advanced.md
├── Tools
├── TaiPan
│ ├── TaiPan_Data_Access_CSharp
│ │ ├── .vs
│ │ │ └── TaiPan_Data_Access_CSharp
│ │ │ │ └── v16
│ │ │ │ └── Server
│ │ │ │ └── sqlite3
│ │ │ │ ├── db.lock
│ │ │ │ └── storage.ide
│ │ ├── Forms_Application
│ │ │ ├── App.config
│ │ │ ├── Properties
│ │ │ │ ├── Settings.settings
│ │ │ │ ├── Settings.Designer.cs
│ │ │ │ ├── AssemblyInfo.cs
│ │ │ │ ├── Resources.Designer.cs
│ │ │ │ └── Resources.resx
│ │ │ ├── Program.cs
│ │ │ ├── Forms_Application.csproj
│ │ │ └── Main.resx
│ │ └── TaiPan_Data_Access_CSharp.sln
│ └── TaiPan_Data_Access_Excel
│ │ └── taipan.xlsx
├── XTB
│ └── Ordersize
│ │ ├── XTB_ordersize.pdf
│ │ └── XTB_ordersize.xlsx
├── README.md
├── Lists
│ ├── SP500_Sectors
│ │ ├── SP500_Sectors_Materials.csv
│ │ ├── SP500_Sectors_Utilities.csv
│ │ ├── SP500_Sectors_Consumer_Staples.csv
│ │ ├── SP500_Sectors_Energy.csv
│ │ ├── SP500_Sectors_Health_Care.csv
│ │ ├── SP500_Sectors_Telecom.csv
│ │ ├── SP500_Sectors_Industrials.csv
│ │ ├── SP500_Sectors_Technology.csv
│ │ ├── SP500_Sectors_Consumer_Discretionary.csv
│ │ └── SP500_Sectors_Financials.csv
│ └── CNBC_IQ100
│ │ └── IQ100.csv
└── Indicator
│ ├── InstrumentIsInList_tool.cs
│ └── Change_quantity_by_click_tool.cs
├── Condition
├── README.md
├── TrailingPercentage_Condition_Stop.cs
├── TradingTimeActive_Condition.cs
├── ShowGap_Condition.cs
├── TrendTemplate_MarkMinervini_Condition.cs
├── Holy_Grail_Condition.cs
├── Lonely_Warrior_Condition.cs
├── PopGun_Condition.cs
├── Elder_Ray_Bull_and_Bear_Power_Condition.cs
└── RunningWithTheWolves_Condition.cs
├── Utilities
└── README.md
├── Strategy
├── README.md
├── Reversal2NextBar_Strategy.cs
└── DeepCorrectionTrend_Strategy.cs
├── LICENSE.md
├── Indicator
├── README.md
├── Volatility_Levy_Stand_Dev_Mean_Average_Indicator.cs
├── Bullbreath_Indicator.cs
├── CompareInstrument_Indicator.cs
├── VDAX_NEW_OnVista_Indicator.cs
├── Phil_Town_macd_stoc_ma_Indicator.cs
├── Momentum_Levy_Portfolio_Rank_Indicator.cs
├── Trendstability_Indicator.cs
├── Market_Meanness_Index_Indicator.cs
├── Elder_Ray_Bull_and_Bear_Power_Indicator.cs
├── Trendstrength_Indicator.cs
├── King_Pinball_Indicator.cs
├── Choppy_Market_Index_Indicator.cs
├── Distance_Indicator.cs
├── Performance_Indicator.cs
├── HighestHighValue_Indicator.cs
├── FiscalYear_Indicator.cs
├── TrendTemplate_MarkMinervini_Indicator.cs
└── PinBar_Indicator.cs
├── .gitignore
└── README.md
/Statistic/README.md:
--------------------------------------------------------------------------------
1 | #Statistic
2 |
3 | **in progress**
--------------------------------------------------------------------------------
/.gitattributes:
--------------------------------------------------------------------------------
1 | # Auto detect text files and perform LF normalization
2 | * text=auto
--------------------------------------------------------------------------------
/Tutorial/README.md:
--------------------------------------------------------------------------------
1 | This postings have moved to our blog: http://script-trading.com/blog/
2 |
--------------------------------------------------------------------------------
/Tools/TaiPan/TaiPan_Data_Access_CSharp/.vs/TaiPan_Data_Access_CSharp/v16/Server/sqlite3/db.lock:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/Statistic/Example.xlsx:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/simonpucher/AgenaTrader/HEAD/Statistic/Example.xlsx
--------------------------------------------------------------------------------
/Tutorial/AgenaTraderDLL/README.md:
--------------------------------------------------------------------------------
1 | This posting has moved to our blog: http://script-trading.com/blog/
2 |
--------------------------------------------------------------------------------
/Tutorial/Connect_GitHub_with_AgenaTrader/README.md:
--------------------------------------------------------------------------------
1 | This posting has moved to our blog: http://script-trading.com/blog/
2 |
--------------------------------------------------------------------------------
/Tutorial/Example_Indicator_Condition_Strategy/README.md:
--------------------------------------------------------------------------------
1 | This posting has moved to our blog: http://script-trading.com/blog/
2 |
--------------------------------------------------------------------------------
/Tools/XTB/Ordersize/XTB_ordersize.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/simonpucher/AgenaTrader/HEAD/Tools/XTB/Ordersize/XTB_ordersize.pdf
--------------------------------------------------------------------------------
/Tools/XTB/Ordersize/XTB_ordersize.xlsx:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/simonpucher/AgenaTrader/HEAD/Tools/XTB/Ordersize/XTB_ordersize.xlsx
--------------------------------------------------------------------------------
/Tools/TaiPan/TaiPan_Data_Access_Excel/taipan.xlsx:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/simonpucher/AgenaTrader/HEAD/Tools/TaiPan/TaiPan_Data_Access_Excel/taipan.xlsx
--------------------------------------------------------------------------------
/Tutorial/Example_Indicator_Condition_Strategy/Example_Indicator_Condition_Strategy.md:
--------------------------------------------------------------------------------
1 | This posting has moved to our blog: http://script-trading.com/blog/
2 |
--------------------------------------------------------------------------------
/Tutorial/Example_Indicator_Condition_Strategy/Example_Indicator_Condition_Strategy_Advanced.md:
--------------------------------------------------------------------------------
1 | This posting has moved to our blog: http://script-trading.com/blog/
2 |
--------------------------------------------------------------------------------
/Tools/README.md:
--------------------------------------------------------------------------------
1 | # Tools
2 | In this section you will find small tools or helpers.
3 |
4 | ## Indicator
5 | Small tool/helpers. You ned to import them as a indicator into AgenaTrader.
6 |
7 | ## TaiPan
8 | Examples on how to use TaiPan Datafeed Service.
--------------------------------------------------------------------------------
/Tools/TaiPan/TaiPan_Data_Access_CSharp/.vs/TaiPan_Data_Access_CSharp/v16/Server/sqlite3/storage.ide:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/simonpucher/AgenaTrader/HEAD/Tools/TaiPan/TaiPan_Data_Access_CSharp/.vs/TaiPan_Data_Access_CSharp/v16/Server/sqlite3/storage.ide
--------------------------------------------------------------------------------
/Tools/TaiPan/TaiPan_Data_Access_CSharp/Forms_Application/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/Tools/Lists/SP500_Sectors/SP500_Sectors_Materials.csv:
--------------------------------------------------------------------------------
1 |
2 | AA
3 | ALB
4 | APD
5 | AVY
6 | BLL
7 | CF
8 | DD
9 | DOW
10 | ECL
11 | EMN
12 | FCX
13 | FMC
14 | IFF
15 | IP
16 | LYB
17 | MLM
18 | MON
19 | MOS
20 | NEM
21 | NUE
22 | OI
23 | PPG
24 | PX
25 | SEE
26 | SHW
27 | VMC
28 | WRK
29 |
--------------------------------------------------------------------------------
/Tools/Lists/SP500_Sectors/SP500_Sectors_Utilities.csv:
--------------------------------------------------------------------------------
1 |
2 | AEE
3 | AEP
4 | AES
5 | AWK
6 | CMS
7 | CNP
8 | D
9 | DTE
10 | DUK
11 | ED
12 | EIX
13 | ES
14 | ETR
15 | EXC
16 | FE
17 | LNT
18 | NEE
19 | NI
20 | NRG
21 | PCG
22 | PEG
23 | PNW
24 | PPL
25 | SCG
26 | SO
27 | SRE
28 | WEC
29 | XEL
30 |
--------------------------------------------------------------------------------
/Tools/TaiPan/TaiPan_Data_Access_CSharp/Forms_Application/Properties/Settings.settings:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/Tools/Lists/SP500_Sectors/SP500_Sectors_Consumer_Staples.csv:
--------------------------------------------------------------------------------
1 |
2 | ADM
3 | BF.B
4 | CAG
5 | CHD
6 | CL
7 | CLX
8 | COST
9 | CPB
10 | CVS
11 | DPS
12 | EL
13 | GIS
14 | HRL
15 | HSY
16 | K
17 | KHC
18 | KMB
19 | KO
20 | KR
21 | MDLZ
22 | MJN
23 | MKC
24 | MNST
25 | MO
26 | PEP
27 | PG
28 | PM
29 | RAI
30 | SJM
31 | STZ
32 | SYY
33 | TAP
34 | TSN
35 | WBA
36 | WFM
37 | WMT
38 |
--------------------------------------------------------------------------------
/Tools/Lists/SP500_Sectors/SP500_Sectors_Energy.csv:
--------------------------------------------------------------------------------
1 |
2 | APA
3 | APC
4 | BHI
5 | CHK
6 | COG
7 | COP
8 | CVX
9 | CXO
10 | DO
11 | DVN
12 | EOG
13 | EQT
14 | FTI
15 | HAL
16 | HES
17 | HP
18 | KMI
19 | MPC
20 | MRO
21 | MUR
22 | NBL
23 | NFX
24 | NOV
25 | OKE
26 | OXY
27 | PSX
28 | PXD
29 | RIG
30 | RRC
31 | SE
32 | SLB
33 | SWN
34 | TSO
35 | VLO
36 | WMB
37 | XEC
38 | XOM
39 |
--------------------------------------------------------------------------------
/Condition/README.md:
--------------------------------------------------------------------------------
1 | # Conditions for Agena Trader
2 |
3 | ## Important
4 | To compile indicators, conditions and other script resources without any error your Agena Trader also need access to the utility indicator to use these global source code elements. You will find this indicator on GitHub: [Global Utilities](https://github.com/ScriptTrading/Basic-Package/blob/master/Utilities/GlobalUtilities_Utility.cs)
5 |
6 | ## Show Gap
7 | *** In Progress ***
8 |
9 | ## Open Range
10 | *** In Progress ***
--------------------------------------------------------------------------------
/Tools/Lists/SP500_Sectors/SP500_Sectors_Health_Care.csv:
--------------------------------------------------------------------------------
1 |
2 | A
3 | ABBV
4 | ABC
5 | ABT
6 | AET
7 | AGN
8 | ALXN
9 | AMGN
10 | ANTM
11 | BAX
12 | BCR
13 | BDX
14 | BIIB
15 | BMY
16 | BSX
17 | CAH
18 | CELG
19 | CERN
20 | CI
21 | CNC
22 | DGX
23 | DVA
24 | ENDP
25 | ESRX
26 | EW
27 | GILD
28 | HCA
29 | HOLX
30 | HSIC
31 | HUM
32 | ILMN
33 | ISRG
34 | JNJ
35 | LH
36 | LLY
37 | MCK
38 | MDT
39 | MNK
40 | MRK
41 | MYL
42 | PDCO
43 | PFE
44 | PKI
45 | PRGO
46 | REGN
47 | STJ
48 | SYK
49 | TMO
50 | UHS
51 | UNH
52 | VAR
53 | VRTX
54 | WAT
55 | XRAY
56 | ZBH
57 | ZTS
58 |
--------------------------------------------------------------------------------
/Tools/Lists/SP500_Sectors/SP500_Sectors_Telecom.csv:
--------------------------------------------------------------------------------
1 |
2 | ADTN
3 | ANET
4 | ARRS
5 | ATNI
6 | BRCD
7 | CAMP
8 | CBB
9 | CCOI
10 | CIEN
11 | CMTL
12 | CNSL
13 | COMM
14 | CSCO
15 | CTL
16 | EXTR
17 | FFIV
18 | FNSR
19 | FTR
20 | GNCMA
21 | GSAT
22 | HRS
23 | IDCC
24 | INFN
25 | IQNT
26 | IRDM
27 | JNPR
28 | LITE
29 | LVLT
30 | MSI
31 | NIHD
32 | NTCT
33 | NTGR
34 | OCLR
35 | ORBC
36 | PANW
37 | PLT
38 | S
39 | SATS
40 | SBAC
41 | SHEN
42 | SHOR
43 | SONS
44 | T
45 | TDS
46 | TMUS
47 | UBNT
48 | USM
49 | VG
50 | VIAV
51 | VSAT
52 | VZ
53 | WIN
54 | XXIA
55 | ZAYO
56 |
--------------------------------------------------------------------------------
/Utilities/README.md:
--------------------------------------------------------------------------------
1 | # Utility for Agena Trader
2 | These classes are helpers and small tools to enhance usability and functions in Agena Trader.
3 |
4 | ## Important
5 | To compile indicators, conditions and other script resources without any error your Agena Trader also need access to the utility indicator to use these global source code elements. You will find this indicator on GitHub: [Global Utilities](https://github.com/SimonPucher/AgenaTrader//blob/master/Utilities/GlobalUtilities_Utility.cs).
6 |
7 | ## Global Utilities
8 | You should use utility classes to share global functions and constants in Agena Trader Script.
9 |
--------------------------------------------------------------------------------
/Tools/Lists/SP500_Sectors/SP500_Sectors_Industrials.csv:
--------------------------------------------------------------------------------
1 |
2 | AAL
3 | ALK
4 | ALLE
5 | AME
6 | AYI
7 | BA
8 | CAT
9 | CHRW
10 | CMI
11 | COL
12 | CSX
13 | CTAS
14 | DAL
15 | DE
16 | DNB
17 | DOV
18 | EFX
19 | EMR
20 | ETN
21 | EXPD
22 | FAST
23 | FBHS
24 | FDX
25 | FLR
26 | FLS
27 | FTV
28 | GD
29 | GE
30 | GWW
31 | HON
32 | IR
33 | ITW
34 | JBHT
35 | JEC
36 | KSU
37 | LLL
38 | LMT
39 | LUV
40 | MAS
41 | MMM
42 | NLSN
43 | NOC
44 | NSC
45 | PBI
46 | PCAR
47 | PH
48 | PNR
49 | PWR
50 | R
51 | RHI
52 | ROK
53 | ROP
54 | RSG
55 | RTN
56 | SNA
57 | SRCL
58 | SWK
59 | TDG
60 | TXT
61 | UAL
62 | UNP
63 | UPS
64 | URI
65 | UTX
66 | VRSK
67 | WM
68 | XYL
69 |
--------------------------------------------------------------------------------
/Tools/TaiPan/TaiPan_Data_Access_CSharp/Forms_Application/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Threading.Tasks;
5 | using System.Windows.Forms;
6 |
7 | namespace WindowsFormsApplication1
8 | {
9 | static class Program
10 | {
11 | ///
12 | /// The main entry point for the application.
13 | ///
14 | [STAThread]
15 | static void Main()
16 | {
17 | Application.EnableVisualStyles();
18 | Application.SetCompatibleTextRenderingDefault(false);
19 | Application.Run(new Main());
20 | }
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/Tools/Lists/SP500_Sectors/SP500_Sectors_Technology.csv:
--------------------------------------------------------------------------------
1 |
2 | AAPL
3 | ACN
4 | ADBE
5 | ADI
6 | ADP
7 | ADS
8 | ADSK
9 | AKAM
10 | AMAT
11 | APH
12 | ATVI
13 | AVGO
14 | CA
15 | CRM
16 | CSCO
17 | CSRA
18 | CTL
19 | CTSH
20 | CTXS
21 | EA
22 | EBAY
23 | FB
24 | FFIV
25 | FIS
26 | FISV
27 | FLIR
28 | FSLR
29 | FTR
30 | GLW
31 | GOOG
32 | GOOGL
33 | GPN
34 | HPE
35 | HPQ
36 | HRS
37 | IBM
38 | INTC
39 | INTU
40 | JNPR
41 | KLAC
42 | LLTC
43 | LRCX
44 | LVLT
45 | MA
46 | MCHP
47 | MSFT
48 | MSI
49 | MU
50 | NTAP
51 | NVDA
52 | ORCL
53 | PAYX
54 | PYPL
55 | QCOM
56 | QRVO
57 | RHT
58 | STX
59 | SWKS
60 | SYMC
61 | T
62 | TDC
63 | TEL
64 | TSS
65 | TXN
66 | V
67 | VRSN
68 | VZ
69 | WDC
70 | WU
71 | XLNX
72 | XRX
73 | YHOO
74 |
--------------------------------------------------------------------------------
/Tools/Lists/SP500_Sectors/SP500_Sectors_Consumer_Discretionary.csv:
--------------------------------------------------------------------------------
1 |
2 | AAP
3 | AMZN
4 | AN
5 | AZO
6 | BBBY
7 | BBY
8 | BWA
9 | CBS
10 | CCL
11 | CHTR
12 | CMCSA
13 | CMG
14 | COH
15 | DG
16 | DHI
17 | DIS
18 | DISCA
19 | DISCK
20 | DLPH
21 | DLTR
22 | DRI
23 | EXPE
24 | F
25 | FL
26 | FOX
27 | FOXA
28 | GM
29 | GPC
30 | GPS
31 | GRMN
32 | GT
33 | HAR
34 | HAS
35 | HBI
36 | HD
37 | HOG
38 | HRB
39 | IPG
40 | JCI
41 | JWN
42 | KMX
43 | KORS
44 | KSS
45 | LB
46 | LEG
47 | LEN
48 | LKQ
49 | LOW
50 | M
51 | MAR
52 | MAT
53 | MCD
54 | MHK
55 | NFLX
56 | NKE
57 | NWL
58 | NWS
59 | NWSA
60 | OMC
61 | ORLY
62 | PCLN
63 | PHM
64 | PVH
65 | RCL
66 | RL
67 | ROST
68 | SBUX
69 | SIG
70 | SNI
71 | SPLS
72 | TGNA
73 | TGT
74 | TIF
75 | TJX
76 | TRIP
77 | TSCO
78 | TWX
79 | UA
80 | UA.C
81 | ULTA
82 | URBN
83 | VFC
84 | VIAB
85 | WHR
86 | WYN
87 | WYNN
88 | YUM
89 |
--------------------------------------------------------------------------------
/Tools/Lists/SP500_Sectors/SP500_Sectors_Financials.csv:
--------------------------------------------------------------------------------
1 |
2 | AFL
3 | AIG
4 | AIV
5 | AIZ
6 | AJG
7 | ALL
8 | AMG
9 | AMP
10 | AMT
11 | AON
12 | AVB
13 | AXP
14 | BAC
15 | BBT
16 | BEN
17 | BK
18 | BLK
19 | BRK.B
20 | BXP
21 | C
22 | CB
23 | CBG
24 | CCI
25 | CFG
26 | CINF
27 | CMA
28 | CME
29 | COF
30 | DFS
31 | DLR
32 | EQIX
33 | EQR
34 | ESS
35 | ETFC
36 | EXR
37 | FITB
38 | FRT
39 | GGP
40 | GS
41 | HBAN
42 | HCN
43 | HCP
44 | HIG
45 | HST
46 | ICE
47 | IRM
48 | IVZ
49 | JPM
50 | KEY
51 | KIM
52 | L
53 | LM
54 | LNC
55 | LUK
56 | MAC
57 | MCO
58 | MET
59 | MMC
60 | MS
61 | MTB
62 | NAVI
63 | NDAQ
64 | NTRS
65 | O
66 | PBCT
67 | PFG
68 | PGR
69 | PLD
70 | PNC
71 | PRU
72 | PSA
73 | RF
74 | SCHW
75 | SLG
76 | SPG
77 | SPGI
78 | STI
79 | STT
80 | SYF
81 | TMK
82 | TROW
83 | TRV
84 | UDR
85 | UNM
86 | USB
87 | VNO
88 | VTR
89 | WFC
90 | WLTW
91 | WY
92 | XL
93 | ZION
94 |
--------------------------------------------------------------------------------
/Strategy/README.md:
--------------------------------------------------------------------------------
1 | # Strategies for Agena Trader
2 |
3 | ## Important
4 | To compile indicators, conditions and other script resources without any error your Agena Trader also need access to the utility indicator to use these global source code elements. You will find this indicator on GitHub: [Global Utilities](https://github.com/ScriptTrading/Basic-Package/blob/master/Utilities/GlobalUtilities_Utility.cs)
5 |
6 | ## Open Range
7 | The initial version of this strategy was inspired by the work of Birger Schäfermeier: [ORB by Birger Schäfermeier](https://www.whselfinvest.at/de/Store_Birger_Schaefermeier_Trading_Strategie_Open_Range_Break_Out.php)
8 |
9 | Further developments are inspired by the work of Mehmet Emre Cekirdekci and Veselin Iliev from the Worcester Polytechnic Institute (2010) [Trading System Development: Trading the Opening Range Breakouts] (https://www.wpi.edu/Pubs/E-project/Available/E-project-042910-142422/unrestricted/Veselin_Iliev_IQP.pdf)
10 |
11 |
12 |
--------------------------------------------------------------------------------
/Tools/Lists/CNBC_IQ100/IQ100.csv:
--------------------------------------------------------------------------------
1 |
2 | A
3 | AAPL
4 | AGN
5 | AMAT
6 | AMD
7 | AMZN
8 | AVGO
9 | AVY
10 | AXP
11 | BA
12 | BAC
13 | BCR
14 | BDX
15 | BHI
16 | C.S
17 | CA
18 | CAH
19 | CBS
20 | CLX
21 | CMI
22 | CR
23 | CSC
24 | CTSH
25 | CVX
26 | DD.S
27 | DE
28 | DHR
29 | DOV
30 | DOW
31 | ELY
32 | EMN
33 | ESRX
34 | ETN
35 | EW
36 | FISV
37 | GE.S
38 | GIS
39 | GM
40 | GRMN
41 | HIG
42 | HON
43 | HPQ
44 | HRS
45 | IBM
46 | IP
47 | ITW
48 | JCI
49 | JNJ
50 | JPM
51 | KMB
52 | KO
53 | LMT
54 | LVLT
55 | MA
56 | MAT
57 | MDLZ
58 | MDT
59 | MET
60 | MMM
61 | MON
62 | MSFT
63 | MSI
64 | MU
65 | NBR
66 | NCR
67 | NKE
68 | NOC
69 | ORCL
70 | PCLN
71 | PFE
72 | PG
73 | PGR
74 | PRU
75 | PX
76 | QCOM
77 | ROK
78 | RTN
79 | SEE
80 | SLB
81 | SNE
82 | SON
83 | SYK
84 | T
85 | TEL
86 | TER
87 | TEVA
88 | TGT
89 | TXN
90 | TXT
91 | UNH
92 | UTX
93 | V
94 | VZ
95 | WDC
96 | WHR
97 | WY
98 | XLNX
99 | XOM
100 | XRX
101 | YHOO
102 |
--------------------------------------------------------------------------------
/Tools/TaiPan/TaiPan_Data_Access_CSharp/TaiPan_Data_Access_CSharp.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio 2013
4 | VisualStudioVersion = 12.0.40629.0
5 | MinimumVisualStudioVersion = 10.0.40219.1
6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Forms_Application", "Forms_Application\Forms_Application.csproj", "{F4F42A38-3BE9-4D10-85B0-ECE2AA6CE577}"
7 | EndProject
8 | Global
9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
10 | Debug|Any CPU = Debug|Any CPU
11 | Release|Any CPU = Release|Any CPU
12 | EndGlobalSection
13 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
14 | {F4F42A38-3BE9-4D10-85B0-ECE2AA6CE577}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
15 | {F4F42A38-3BE9-4D10-85B0-ECE2AA6CE577}.Debug|Any CPU.Build.0 = Debug|Any CPU
16 | {F4F42A38-3BE9-4D10-85B0-ECE2AA6CE577}.Release|Any CPU.ActiveCfg = Release|Any CPU
17 | {F4F42A38-3BE9-4D10-85B0-ECE2AA6CE577}.Release|Any CPU.Build.0 = Release|Any CPU
18 | EndGlobalSection
19 | GlobalSection(SolutionProperties) = preSolution
20 | HideSolutionNode = FALSE
21 | EndGlobalSection
22 | EndGlobal
23 |
--------------------------------------------------------------------------------
/LICENSE.md:
--------------------------------------------------------------------------------
1 | The MIT License (MIT)
2 |
3 | Copyright (c) 2016 Simon Pucher
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/Tools/TaiPan/TaiPan_Data_Access_CSharp/Forms_Application/Properties/Settings.Designer.cs:
--------------------------------------------------------------------------------
1 | //------------------------------------------------------------------------------
2 | //
3 | // This code was generated by a tool.
4 | // Runtime Version:4.0.30319.42000
5 | //
6 | // Changes to this file may cause incorrect behavior and will be lost if
7 | // the code is regenerated.
8 | //
9 | //------------------------------------------------------------------------------
10 |
11 | namespace WindowsFormsApplication1.Properties {
12 |
13 |
14 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
15 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "12.0.0.0")]
16 | internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
17 |
18 | private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
19 |
20 | public static Settings Default {
21 | get {
22 | return defaultInstance;
23 | }
24 | }
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/Indicator/README.md:
--------------------------------------------------------------------------------
1 | # Indikatoren
2 |
3 | ## Important
4 | To compile indicators, conditions and other script resources without any error your Agena Trader also need access to the utility indicator to use these global source code elements. You will find this indicator on GitHub: [Global Utilities](https://github.com/ScriptTrading/Basic-Package/blob/master/Utilities/GlobalUtilities_Utility.cs)
5 |
6 | ## Coppock Curve
7 | [Funktionsweise](https://en.wikipedia.org/wiki/Coppock_curve)
8 |
9 | *** In Progress ***
10 |
11 | ## Fibonacci Current Session
12 | *** In Progress ***
13 |
14 | ## FindHighLowTimeFrame
15 | Finds the high and low value in a dedicated time frame. Indicator draws a rectangle on this dedicated time frame. Draws a high and low line at the current session.
16 |
17 | ## HighestHighValue
18 | Compare the current value of an indicator to latest high value of the indicator in a defined period of time.
19 |
20 | ## Open Range Breakout (ORB)
21 | [Funktionsweise](https://www.whselfinvest.at/de/Store_Birger_Schaefermeier_Trading_Strategie_Open_Range_Break_Out.php)
22 |
23 | *** In Progress ***
24 |
25 | ## Reversal2NextBar
26 |
27 | ## Seasonal
28 |
29 | ## Quantitative Qualitative Estimation (QQE)
30 | [Funktionsweise](https://en.wikipedia.org/wiki/Zero_lag_exponential_moving_average)
31 |
32 | *** In Progress ***
33 |
34 | ## ShowGap
35 | *** In Progress ***
36 |
37 | ## PopGun
38 | *** In Progress ***
39 |
40 | ## Traders Dynamic Index (TDI)
41 | [Funktionsweise](http://www.earnforex.com/metatrader-indicators/Traders-Dynamic-Index/)
42 |
43 |
44 |
45 |
46 |
47 |
--------------------------------------------------------------------------------
/Tools/TaiPan/TaiPan_Data_Access_CSharp/Forms_Application/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 | using System.Runtime.InteropServices;
4 |
5 | // General Information about an assembly is controlled through the following
6 | // set of attributes. Change these attribute values to modify the information
7 | // associated with an assembly.
8 | [assembly: AssemblyTitle("WindowsFormsApplication1")]
9 | [assembly: AssemblyDescription("")]
10 | [assembly: AssemblyConfiguration("")]
11 | [assembly: AssemblyCompany("")]
12 | [assembly: AssemblyProduct("WindowsFormsApplication1")]
13 | [assembly: AssemblyCopyright("Copyright © 2016")]
14 | [assembly: AssemblyTrademark("")]
15 | [assembly: AssemblyCulture("")]
16 |
17 | // Setting ComVisible to false makes the types in this assembly not visible
18 | // to COM components. If you need to access a type in this assembly from
19 | // COM, set the ComVisible attribute to true on that type.
20 | [assembly: ComVisible(false)]
21 |
22 | // The following GUID is for the ID of the typelib if this project is exposed to COM
23 | [assembly: Guid("e0295cae-0443-4311-83aa-1e3271747410")]
24 |
25 | // Version information for an assembly consists of the following four values:
26 | //
27 | // Major Version
28 | // Minor Version
29 | // Build Number
30 | // Revision
31 | //
32 | // You can specify all the values or you can default the Build and Revision Numbers
33 | // by using the '*' as shown below:
34 | // [assembly: AssemblyVersion("1.0.*")]
35 | [assembly: AssemblyVersion("1.0.0.0")]
36 | [assembly: AssemblyFileVersion("1.0.0.0")]
37 |
--------------------------------------------------------------------------------
/Indicator/Volatility_Levy_Stand_Dev_Mean_Average_Indicator.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.ComponentModel;
4 | using System.Drawing;
5 | using System.Drawing.Drawing2D;
6 | using System.Linq;
7 | using System.Xml;
8 | using System.Xml.Serialization;
9 | using AgenaTrader.API;
10 | using AgenaTrader.Custom;
11 | using AgenaTrader.Plugins;
12 | using AgenaTrader.Helper;
13 |
14 | ///
15 | /// Version: 1.4
16 | /// -------------------------------------------------------------------------
17 | /// Simon Pucher 2017
18 | /// -------------------------------------------------------------------------
19 | /// ****** Important ******
20 | /// To compile this script without any error you also need access to the utility indicator to use these global source code elements.
21 | /// You will find this indicator on GitHub: https://raw.githubusercontent.com/simonpucher/AgenaTrader/master/Utilities/GlobalUtilities_Utility.cs
22 | /// -------------------------------------------------------------------------
23 | /// Namespace holds all indicators and is required. Do not change it.
24 | ///
25 | namespace AgenaTrader.UserCode
26 | {
27 | [Description("Volatility Indicator by Robert Levy.")]
28 | public class Volatility_Levy_Stand_Dev_Mean_Average_Indicator : UserIndicator
29 | {
30 | private int _period = 27;
31 |
32 |
33 | protected override void OnInit()
34 | {
35 | Add(new OutputDescriptor(Color.FromKnownColor(KnownColor.Orange), "Plot_Volatility_Levy_"+this.Period));
36 | }
37 |
38 | protected override void OnCalculate()
39 | {
40 |
41 | MyPlot1.Set(StdDev(this.Period)[0] / SMA(this.Period)[0]);
42 | }
43 |
44 | public override string ToString()
45 | {
46 | return "Volatility Levy (I)";
47 | }
48 |
49 | public override string DisplayName
50 | {
51 | get
52 | {
53 | return "Volatility Levy (I)";
54 | }
55 | }
56 |
57 |
58 | #region Properties
59 |
60 | [Browsable(false)]
61 | [XmlIgnore()]
62 | public DataSeries MyPlot1
63 | {
64 | get { return Outputs[0]; }
65 | }
66 |
67 | ///
68 | ///
69 | [Description("Number of historical bars.")]
70 | [InputParameter]
71 | [DisplayName("Period")]
72 | public int Period
73 | {
74 | get { return _period; }
75 | set { _period = value; }
76 | }
77 |
78 | #endregion
79 | }
80 | }
--------------------------------------------------------------------------------
/Tools/TaiPan/TaiPan_Data_Access_CSharp/Forms_Application/Properties/Resources.Designer.cs:
--------------------------------------------------------------------------------
1 | //------------------------------------------------------------------------------
2 | //
3 | // This code was generated by a tool.
4 | // Runtime Version:4.0.30319.42000
5 | //
6 | // Changes to this file may cause incorrect behavior and will be lost if
7 | // the code is regenerated.
8 | //
9 | //------------------------------------------------------------------------------
10 |
11 | namespace WindowsFormsApplication1.Properties {
12 | using System;
13 |
14 |
15 | ///
16 | /// A strongly-typed resource class, for looking up localized strings, etc.
17 | ///
18 | // This class was auto-generated by the StronglyTypedResourceBuilder
19 | // class via a tool like ResGen or Visual Studio.
20 | // To add or remove a member, edit your .ResX file then rerun ResGen
21 | // with the /str option, or rebuild your VS project.
22 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
23 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
24 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
25 | internal class Resources {
26 |
27 | private static global::System.Resources.ResourceManager resourceMan;
28 |
29 | private static global::System.Globalization.CultureInfo resourceCulture;
30 |
31 | [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
32 | internal Resources() {
33 | }
34 |
35 | ///
36 | /// Returns the cached ResourceManager instance used by this class.
37 | ///
38 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
39 | internal static global::System.Resources.ResourceManager ResourceManager {
40 | get {
41 | if (object.ReferenceEquals(resourceMan, null)) {
42 | global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("WindowsFormsApplication1.Properties.Resources", typeof(Resources).Assembly);
43 | resourceMan = temp;
44 | }
45 | return resourceMan;
46 | }
47 | }
48 |
49 | ///
50 | /// Overrides the current thread's CurrentUICulture property for all
51 | /// resource lookups using this strongly typed resource class.
52 | ///
53 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
54 | internal static global::System.Globalization.CultureInfo Culture {
55 | get {
56 | return resourceCulture;
57 | }
58 | set {
59 | resourceCulture = value;
60 | }
61 | }
62 | }
63 | }
64 |
--------------------------------------------------------------------------------
/Condition/TrailingPercentage_Condition_Stop.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.ComponentModel;
4 | using System.Drawing;
5 | using System.Drawing.Drawing2D;
6 | using System.Linq;
7 | using System.Xml;
8 | using System.Xml.Serialization;
9 | using AgenaTrader.API;
10 | using AgenaTrader.Custom;
11 | using AgenaTrader.Plugins;
12 | using AgenaTrader.Helper;
13 |
14 | ///
15 | /// Version: 1.4
16 | /// -------------------------------------------------------------------------
17 | /// Simon Pucher 2021
18 | /// -------------------------------------------------------------------------
19 | /// ****** Important ******
20 | /// To compile this script without any error you also need access to the utility indicator to use global source code elements.
21 | /// You will find this script on GitHub: https://raw.githubusercontent.com/simonpucher/AgenaTrader/master/Utilities/GlobalUtilities_Utility.cs
22 | /// -------------------------------------------------------------------------
23 | /// Namespace holds all indicators and is required. Do not change it.
24 | ///
25 | namespace AgenaTrader.UserCode
26 | {
27 | [Category("Script-Trading")]
28 | [Description("Trailing Stop with percentage value.")]
29 | [IsEntryAttribute(false)]
30 | [IsStopAttribute(true)]
31 | [IsTargetAttribute(false)]
32 | [OverrulePreviousStopPrice(false)]
33 | public class TrailingPercentage_Condition_Stop : UserScriptedCondition
34 | {
35 | #region Variables
36 |
37 | private double _percentagetrailing = 3.0;
38 |
39 | #endregion
40 |
41 | protected override void OnInit()
42 | {
43 | IsEntry = false;
44 | IsStop = true;
45 | IsTarget = false;
46 | Add(new OutputDescriptor(Color.FromKnownColor(KnownColor.Black), "Occurred"));
47 | Add(new OutputDescriptor(Color.Orange, "Stop"));
48 | IsOverlay = true;
49 | CalculateOnClosedBar = true;
50 | OverridePreviousStop = false;
51 | }
52 |
53 | protected override void OnCalculate()
54 | {
55 | Occurred.Set(1);
56 | Stop.Set(Close[0] * (1 - this.PercentageTrailing / 100.0));
57 | }
58 |
59 | #region Properties
60 |
61 | [Browsable(false)]
62 | [XmlIgnore()]
63 | public DataSeries Occurred
64 | {
65 | get { return Outputs[0]; }
66 | }
67 |
68 | [Browsable(false)]
69 | [XmlIgnore()]
70 | public DataSeries Stop
71 | {
72 | get { return Outputs[1]; }
73 | }
74 |
75 | public override IList GetStops()
76 | {
77 | return new[] { Stop };
78 | }
79 |
80 | [Description("Enter the amount of percentage you want to use in your trailing.")]
81 | [InputParameter]
82 | public double PercentageTrailing
83 | {
84 | get { return _percentagetrailing; }
85 | set { _percentagetrailing = value; }
86 | }
87 |
88 | public override string ToString()
89 | {
90 | return "Trailing Percentage Stop (C)";
91 | }
92 |
93 | public override string DisplayName
94 | {
95 | get
96 | {
97 | return "Trailing Percentage Stop (C)";
98 | }
99 | }
100 |
101 | #endregion
102 | }
103 | }
--------------------------------------------------------------------------------
/Indicator/Bullbreath_Indicator.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.ComponentModel;
4 | using System.Drawing;
5 | using System.Drawing.Drawing2D;
6 | using System.Linq;
7 | using System.Xml;
8 | using System.Xml.Serialization;
9 | using AgenaTrader.API;
10 | using AgenaTrader.Custom;
11 | using AgenaTrader.Plugins;
12 | using AgenaTrader.Helper;
13 |
14 | ///
15 | /// Version: 1.1.0
16 | /// -------------------------------------------------------------------------
17 | /// Simon Pucher 2017
18 | /// -------------------------------------------------------------------------
19 | /// ****** Important ******
20 | /// To compile this script without any error you also need access to the utility indicator to use these global source code elements.
21 | /// You will find this indicator on GitHub: https://raw.githubusercontent.com/simonpucher/AgenaTrader/master/Utilities/GlobalUtilities_Utility.cs
22 | /// -------------------------------------------------------------------------
23 | /// Namespace holds all indicators and is required. Do not change it.
24 | ///
25 | namespace AgenaTrader.UserCode
26 | {
27 | [Description("Count all green candles in the last x candles.")]
28 | public class Bullbreath_Indicator : UserIndicator
29 | {
30 |
31 | private int _period = 10;
32 |
33 | protected override void OnInit()
34 | {
35 | Add(new OutputDescriptor(Color.FromKnownColor(KnownColor.Orange), "Bullbreath_Plot"));
36 | CalculateOnClosedBar = true;
37 | }
38 |
39 | protected override void OnCalculate()
40 | {
41 | if (this.Period > this.RequiredBarsCount)
42 | {
43 | AddChartTextFixed("AlertText", "Required bars must be at least as high as the period.", TextPosition.Center, Color.Red, new Font("Arial", 30), Color.Red, Color.Red, 20);
44 | }
45 |
46 | int myres = 0;
47 | for (int i = 0; i < Period; i++)
48 | {
49 | if (Close[i] > Open[i])
50 | {
51 | myres = myres + 1;
52 | }
53 | }
54 | //MyPlot1.Set(Bars.Reverse().Take(10).Where(x => x.IsGrowing).Count());
55 | MyPlot1.Set(myres * 10);
56 |
57 | }
58 |
59 | #region Properties
60 |
61 | [Browsable(false)]
62 | [XmlIgnore()]
63 | public DataSeries MyPlot1
64 | {
65 | get { return Outputs[0]; }
66 | }
67 |
68 | ///
69 | ///
70 | [Description("Select the period for the bullbreath count.")]
71 | [InputParameter]
72 | [DisplayName("Period")]
73 | public int Period
74 | {
75 | get { return _period; }
76 | set
77 | {
78 | if (value < 1) value = 1;
79 | _period = value;
80 | }
81 | }
82 |
83 |
84 | public override string ToString()
85 | {
86 | return GetNameOnchart();
87 | }
88 |
89 | public override string DisplayName
90 | {
91 | get
92 | {
93 | return GetNameOnchart();
94 | }
95 | }
96 |
97 |
98 | private string GetNameOnchart()
99 | {
100 | return "Bullbreath (I)";
101 | }
102 |
103 | #endregion
104 | }
105 | }
--------------------------------------------------------------------------------
/Indicator/CompareInstrument_Indicator.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.ComponentModel;
4 | using System.Drawing;
5 | using System.Drawing.Drawing2D;
6 | using System.Linq;
7 | using System.Xml;
8 | using System.Xml.Serialization;
9 | using AgenaTrader.API;
10 | using AgenaTrader.Custom;
11 | using AgenaTrader.Plugins;
12 | using AgenaTrader.Helper;
13 |
14 | ///
15 | /// Version: 1.2.2
16 | /// -------------------------------------------------------------------------
17 | /// Simon Pucher 2017
18 | /// -------------------------------------------------------------------------
19 | /// ****** Important ******
20 | /// To compile this script without any error you also need access to the utility indicator to use these global source code elements.
21 | /// You will find this indicator on GitHub: https://raw.githubusercontent.com/simonpucher/AgenaTrader/master/Utilities/GlobalUtilities_Utility.cs
22 | /// -------------------------------------------------------------------------
23 | /// Namespace holds all indicators and is required. Do not change it.
24 | ///
25 | namespace AgenaTrader.UserCode
26 | {
27 | [Description("Compare two instruments.")]
28 | public class CompareInstrument_Indicator : UserIndicator
29 | {
30 |
31 | private const int endOfScale = 1;
32 | private const int topOfScale = 100;
33 |
34 | int i1 = 1;
35 | int i2 = 2;
36 |
37 | protected override void OnInit()
38 | {
39 | Add(new OutputDescriptor(Color.FromKnownColor(KnownColor.Gray), "MyComparePlot_1"));
40 | Add(new OutputDescriptor(Color.FromKnownColor(KnownColor.Orange), "MyComparePlot_2"));
41 | }
42 |
43 | protected override void OnBarsRequirements()
44 | {
45 | Add(Core.InstrumentManager.GetInstrument(this.Instrument.Symbol));
46 | Add(Core.InstrumentManager.GetInstrument(_instrument_2));
47 |
48 | if (this.Instrument.Symbol == _instrument_2)
49 | {
50 | i1 = 0;
51 | i2 = 1;
52 | }
53 | }
54 |
55 |
56 | protected override void OnCalculate()
57 | {
58 | MyPlot1.Set(Normalize(Closes[i1].ToList(), Closes[i1][0]));
59 | MyPlot2.Set(Normalize(Closes[i2].ToList(), Closes[i2][0]));
60 | }
61 |
62 | private static double Normalize(List list, double currentValue)
63 | {
64 |
65 | double min = list.Min();
66 | double max = list.Max();
67 |
68 | return endOfScale + (currentValue - min) * (topOfScale - endOfScale) / (max - min);
69 |
70 | }
71 |
72 | #region Properties
73 |
74 | [Browsable(false)]
75 | [XmlIgnore()]
76 | public DataSeries MyPlot1
77 | {
78 | get { return Outputs[0]; }
79 | }
80 |
81 | [Browsable(false)]
82 | [XmlIgnore()]
83 | public DataSeries MyPlot2
84 | {
85 | get { return Outputs[1]; }
86 | }
87 |
88 |
89 |
90 | private string _instrument_2 = "AAPL";
91 |
92 | [Description("First Symbol to compare")]
93 | [InputParameter]
94 | [DisplayNameAttribute("2nd Symbol")]
95 | public string Symbol_2
96 | {
97 | get { return _instrument_2; }
98 | set { _instrument_2 = value; }
99 | }
100 |
101 | #endregion
102 | }
103 | }
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | ## Ignore Visual Studio temporary files, build results, and
2 | ## files generated by popular Visual Studio add-ons.
3 |
4 | # User-specific files
5 | *.suo
6 | *.user
7 | *.sln.docstates
8 |
9 | # Build results
10 | [Dd]ebug/
11 | [Dd]ebugPublic/
12 | [Rr]elease/
13 | [Rr]eleases/
14 | x64/
15 | x86/
16 | build/
17 | bld/
18 | [Bb]in/
19 | [Oo]bj/
20 |
21 | # Roslyn cache directories
22 | *.ide/
23 |
24 | # MSTest test Results
25 | [Tt]est[Rr]esult*/
26 | [Bb]uild[Ll]og.*
27 |
28 | #NUNIT
29 | *.VisualState.xml
30 | TestResult.xml
31 |
32 | # Build Results of an ATL Project
33 | [Dd]ebugPS/
34 | [Rr]eleasePS/
35 | dlldata.c
36 |
37 | *_i.c
38 | *_p.c
39 | *_i.h
40 | *.ilk
41 | *.meta
42 | *.obj
43 | *.pch
44 | *.pdb
45 | *.pgc
46 | *.pgd
47 | *.rsp
48 | *.sbr
49 | *.tlb
50 | *.tli
51 | *.tlh
52 | *.tmp
53 | *.tmp_proj
54 | *.log
55 | *.vspscc
56 | *.vssscc
57 | .builds
58 | *.pidb
59 | *.svclog
60 | *.scc
61 |
62 | # Chutzpah Test files
63 | _Chutzpah*
64 |
65 | # Visual C++ cache files
66 | ipch/
67 | *.aps
68 | *.ncb
69 | *.opensdf
70 | *.sdf
71 | *.cachefile
72 |
73 | # Visual Studio profiler
74 | *.psess
75 | *.vsp
76 | *.vspx
77 |
78 | # TFS 2012 Local Workspace
79 | $tf/
80 |
81 | # Guidance Automation Toolkit
82 | *.gpState
83 |
84 | # ReSharper is a .NET coding add-in
85 | _ReSharper*/
86 | *.[Rr]e[Ss]harper
87 | *.DotSettings.user
88 |
89 | # JustCode is a .NET coding addin-in
90 | .JustCode
91 |
92 | # TeamCity is a build add-in
93 | _TeamCity*
94 |
95 | # DotCover is a Code Coverage Tool
96 | *.dotCover
97 |
98 | # NCrunch
99 | _NCrunch_*
100 | .*crunch*.local.xml
101 |
102 | # MightyMoose
103 | *.mm.*
104 | AutoTest.Net/
105 |
106 | # Web workbench (sass)
107 | .sass-cache/
108 |
109 | # Installshield output folder
110 | [Ee]xpress/
111 |
112 | # DocProject is a documentation generator add-in
113 | DocProject/buildhelp/
114 | DocProject/Help/*.HxT
115 | DocProject/Help/*.HxC
116 | DocProject/Help/*.hhc
117 | DocProject/Help/*.hhk
118 | DocProject/Help/*.hhp
119 | DocProject/Help/Html2
120 | DocProject/Help/html
121 |
122 | # Click-Once directory
123 | publish/
124 |
125 | # Publish Web Output
126 | *.[Pp]ublish.xml
127 | *.azurePubxml
128 | # TODO: Comment the next line if you want to checkin your web deploy settings
129 | # but database connection strings (with potential passwords) will be unencrypted
130 | *.pubxml
131 | *.publishproj
132 |
133 | # NuGet Packages
134 | *.nupkg
135 | # The packages folder can be ignored because of Package Restore
136 | **/packages/*
137 | # except build/, which is used as an MSBuild target.
138 | !**/packages/build/
139 | # If using the old MSBuild-Integrated Package Restore, uncomment this:
140 | #!**/packages/repositories.config
141 |
142 | # Windows Azure Build Output
143 | csx/
144 | *.build.csdef
145 |
146 | # Windows Store app package directory
147 | AppPackages/
148 |
149 | # Others
150 | sql/
151 | *.Cache
152 | ClientBin/
153 | [Ss]tyle[Cc]op.*
154 | ~$*
155 | *~
156 | *.dbmdl
157 | *.dbproj.schemaview
158 | *.pfx
159 | *.publishsettings
160 | node_modules/
161 |
162 | # RIA/Silverlight projects
163 | Generated_Code/
164 |
165 | # Backup & report files from converting an old project file
166 | # to a newer Visual Studio version. Backup files are not needed,
167 | # because we have git ;-)
168 | _UpgradeReport_Files/
169 | Backup*/
170 | UpgradeLog*.XML
171 | UpgradeLog*.htm
172 |
173 | # SQL Server files
174 | *.mdf
175 | *.ldf
176 |
177 | # Business Intelligence projects
178 | *.rdl.data
179 | *.bim.layout
180 | *.bim_*.settings
181 |
182 | # Microsoft Fakes
183 | FakesAssemblies/
184 |
--------------------------------------------------------------------------------
/Condition/TradingTimeActive_Condition.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.ComponentModel;
4 | using System.Drawing;
5 | using System.Drawing.Drawing2D;
6 | using System.Linq;
7 | using System.Xml;
8 | using System.Xml.Serialization;
9 | using AgenaTrader.API;
10 | using AgenaTrader.Custom;
11 | using AgenaTrader.Plugins;
12 | using AgenaTrader.Helper;
13 |
14 | ///
15 | /// Version: 1.1.1
16 | /// -------------------------------------------------------------------------
17 | /// Simon Pucher 2016
18 | /// -------------------------------------------------------------------------
19 | /// todo description
20 | /// -------------------------------------------------------------------------
21 | /// ****** Important ******
22 | /// To compile this script without any error you also need access to the utility indicator to use global source code elements.
23 | /// You will find this script on GitHub: https://raw.githubusercontent.com/simonpucher/AgenaTrader/master/Utilities/GlobalUtilities_Utility.cs
24 | /// -------------------------------------------------------------------------
25 | /// Namespace holds all indicators and is required. Do not change it.
26 | ///
27 | namespace AgenaTrader.UserCode
28 | {
29 | [Category("Script-Trading")]
30 | [Description("Condition returns false if trading break is active.")]
31 | [IsEntryAttribute(true)]
32 | [IsStopAttribute(false)]
33 | [IsTargetAttribute(false)]
34 | [OverrulePreviousStopPrice(false)]
35 | public class TradingTimeActive_Condition : UserScriptedCondition
36 | {
37 | #region Variables
38 |
39 | private string _start ="12:00:00";
40 | private string _end = "13:00:00";
41 |
42 | #endregion
43 |
44 | protected override void OnInit()
45 | {
46 | IsEntry = true;
47 | IsStop = false;
48 | IsTarget = false;
49 | Add(new OutputDescriptor(Color.FromKnownColor(KnownColor.Black), "Occurred"));
50 | //Add(new OutputDescriptor(Color.FromArgb(255, 183, 128, 170), "Entry"));
51 | IsOverlay = false;
52 | }
53 |
54 | protected override void OnCalculate()
55 | {
56 | //Print(Time[0]);
57 |
58 | TimeSpan now = Time[0].TimeOfDay;
59 |
60 | if ((now >= TimeSpan.Parse(this.Start)) && (now <= TimeSpan.Parse(this.End)))
61 | {
62 | Occurred.Set(0);
63 | }
64 | else
65 | {
66 | Occurred.Set(1);
67 | }
68 |
69 |
70 | }
71 |
72 | #region Properties
73 |
74 | [Browsable(false)]
75 | [XmlIgnore()]
76 | public DataSeries Occurred
77 | {
78 | get { return Outputs[0]; }
79 | }
80 |
81 | [Browsable(false)]
82 | [XmlIgnore()]
83 | public DataSeries Entry
84 | {
85 | get { return Outputs[1]; }
86 | }
87 |
88 | public override IList GetEntries()
89 | {
90 | return new[] { Entry };
91 | }
92 |
93 | [Description("Start of the trading break. (e.g. 12:00:00)")]
94 | [InputParameter]
95 | [DisplayName("Start")]
96 | public string Start
97 | {
98 | get { return _start; }
99 | set { _start = value; }
100 | }
101 |
102 |
103 | [Description("End of the trading break. (e.g. 13:00:00)")]
104 | [InputParameter]
105 | [DisplayName("End")]
106 | public string End
107 | {
108 | get { return _end; }
109 | set { _end = value; }
110 | }
111 |
112 |
113 | #endregion
114 | }
115 | }
--------------------------------------------------------------------------------
/Indicator/VDAX_NEW_OnVista_Indicator.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.ComponentModel;
4 | using System.Drawing;
5 | using System.Drawing.Drawing2D;
6 | using System.Linq;
7 | using System.Xml;
8 | using System.Xml.Serialization;
9 | using AgenaTrader.API;
10 | using AgenaTrader.Custom;
11 | using AgenaTrader.Plugins;
12 | using AgenaTrader.Helper;
13 |
14 | ///
15 | /// Version: in progress
16 | /// -------------------------------------------------------------------------
17 | /// Christian Kovar 2016
18 | /// -------------------------------------------------------------------------
19 | /// Gets latest VDAX_NEW value from OnVista via httpRequest
20 | /// -------------------------------------------------------------------------
21 | /// ****** Important ******
22 | /// To compile this script without any error you also need access to the utility indicator to use these global source code elements.
23 | /// You will find this indicator on GitHub: https://raw.githubusercontent.com/simonpucher/AgenaTrader/master/Utilities/GlobalUtilities_Utility.cs
24 | /// -------------------------------------------------------------------------
25 | /// Namespace holds all indicators and is required. Do not change it.
26 | ///
27 | namespace AgenaTrader.UserCode
28 | {
29 | [Description("Gets latest VDAX_NEW value from OnVista via httpRequest")]
30 | public class VDAX_NEW_OnVista_Indicator : UserIndicator
31 | {
32 | //*** input ***
33 | private TextPosition _TextPosition = TextPosition.BottomRight;
34 | private int _TextSize = 10;
35 | private int _CheckEveryXSeconds = 60;
36 |
37 | //*** internal ***
38 |
39 |
40 |
41 | protected override void OnInit()
42 | {
43 | IsOverlay = true;
44 | }
45 |
46 |
47 | protected override void OnStart()
48 | {
49 | decimal vdax_new = GlobalUtilities.GetCurrentVdaxNew(this.CheckEveryXSeconds);
50 | AddChartTextFixed("VDAX_NEW", "VDAX-NEW: " + vdax_new, this.TextPosition, Color.Black, new Font("Arial", this.TextSize), Color.Transparent, Color.Transparent);
51 | }
52 |
53 |
54 | protected override void OnCalculate()
55 | {
56 |
57 | }
58 |
59 | public override string ToString()
60 | {
61 | return "VDAX-NEW (OnVista)";
62 | }
63 |
64 | public override string DisplayName
65 | {
66 | get
67 | {
68 | return "VDAX-NEW (OnVista)";
69 | }
70 | }
71 |
72 | #region Properties
73 |
74 | #region InSeries
75 |
76 |
77 |
78 |
79 |
80 | ///
81 | ///
82 | [Description("Check online service each x seconds.")]
83 | [Category("Drawings")]
84 | [DisplayName("Seconds Online Check")]
85 | public int CheckEveryXSeconds
86 | {
87 | get { return _CheckEveryXSeconds; }
88 | set { _CheckEveryXSeconds = value; }
89 | }
90 |
91 |
92 | ///
93 | ///
94 | [Description("Text Position")]
95 | [Category("Drawings")]
96 | [DisplayName("Text Position")]
97 | public TextPosition TextPosition
98 | {
99 | get { return _TextPosition; }
100 | set { _TextPosition = value; }
101 | }
102 |
103 | ///
104 | ///
105 | [Description("Text Size")]
106 | [Category("Drawings")]
107 | [DisplayName("Text Size")]
108 | public int TextSize
109 | {
110 | get { return _TextSize; }
111 | set { _TextSize = value; }
112 | }
113 |
114 | #endregion
115 |
116 | #endregion
117 | }
118 | }
--------------------------------------------------------------------------------
/Condition/ShowGap_Condition.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.ComponentModel;
4 | using System.Drawing;
5 | using System.Drawing.Drawing2D;
6 | using System.Linq;
7 | using System.Xml;
8 | using System.Xml.Serialization;
9 | using AgenaTrader.API;
10 | using AgenaTrader.Custom;
11 | using AgenaTrader.Plugins;
12 | using AgenaTrader.Helper;
13 |
14 |
15 | ///
16 | /// Version: in progress
17 | /// -------------------------------------------------------------------------
18 | /// Christian Kovar 2016
19 | /// -------------------------------------------------------------------------
20 | /// todo description
21 | /// -------------------------------------------------------------------------
22 | /// ****** Important ******
23 | /// To compile this script without any error you also need access to the utility indicator to use global source code elements.
24 | /// You will find this script on GitHub: https://raw.githubusercontent.com/simonpucher/AgenaTrader/master/Utilities/GlobalUtilities_Utility.cs
25 | /// -------------------------------------------------------------------------
26 | /// Namespace holds all indicators and is required. Do not change it.
27 | ///
28 | namespace AgenaTrader.UserCode
29 | {
30 | [Category("Script-Trading")]
31 | [Description("Geben Sie bitte hier die Beschreibung für die neue Condition ein")]
32 | [IsEntryAttribute(true)]
33 | [IsStopAttribute(false)]
34 | [IsTargetAttribute(false)]
35 | [OverrulePreviousStopPrice(false)]
36 | public class ShowGap_Condition : UserScriptedCondition
37 | {
38 | #region Variables
39 | decimal _PunkteGapMin = 50;
40 | decimal _PunkteGapMax = 100;
41 | double ShowGap_Indicator_Value;
42 | #endregion
43 |
44 | protected override void OnInit()
45 | {
46 | IsEntry = true;
47 | IsStop = false;
48 | IsTarget = false;
49 | Add(new OutputDescriptor(Color.Azure, "Occurred"));
50 | Add(new OutputDescriptor(Color.LightCyan, "Entry"));
51 | IsOverlay = true;
52 | CalculateOnClosedBar = true;
53 | }
54 |
55 | protected override void OnCalculate()
56 | {
57 |
58 | //ShowGap Indikator aufrufen. Dieser liefert 100 für Long Einstieg und -100 für Short Einstieg. Liefert 0 für kein Einstiegssignal
59 | ShowGap_Indicator_Value = ShowGap_Indicator(PunkteGapMin, PunkteGapMax)[0];
60 |
61 | if ( ShowGap_Indicator_Value == 100 ) {
62 | Occurred.Set(1);
63 | }
64 | else if (ShowGap_Indicator_Value == -100)
65 | {
66 | Occurred.Set(-1);
67 | }
68 | else
69 | {
70 | Occurred.Set(0);
71 | }
72 | }
73 |
74 | #region Properties
75 |
76 | [Browsable(false)]
77 | [XmlIgnore()]
78 | public DataSeries Occurred
79 | {
80 | get { return Outputs[0]; }
81 | }
82 |
83 | [Browsable(false)]
84 | [XmlIgnore()]
85 | public DataSeries Entry
86 | {
87 | get { return Outputs[1]; }
88 | }
89 |
90 | public override IList GetEntries()
91 | {
92 | return new[] { Entry };
93 | }
94 |
95 | [Description("Mind. Punkte für Gap")]
96 | [InputParameter]
97 | [DisplayName("MinPunkte")]
98 | public decimal PunkteGapMin
99 | {
100 | get { return _PunkteGapMin; }
101 | set { _PunkteGapMin = value; }
102 | }
103 |
104 | [Description("Max. Punkte für Gap")]
105 | [InputParameter]
106 | [DisplayName("MaxPunkte")]
107 | public decimal PunkteGapMax
108 | {
109 | get { return _PunkteGapMax; }
110 | set { _PunkteGapMax = value; }
111 | }
112 | #endregion
113 | }
114 | }
--------------------------------------------------------------------------------
/Indicator/Phil_Town_macd_stoc_ma_Indicator.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.ComponentModel;
4 | using System.Drawing;
5 | using System.Drawing.Drawing2D;
6 | using System.Linq;
7 | using System.Xml;
8 | using System.Xml.Serialization;
9 | using AgenaTrader.API;
10 | using AgenaTrader.Custom;
11 | using AgenaTrader.Plugins;
12 | using AgenaTrader.Helper;
13 |
14 | ///
15 | /// Version: 1.1.0
16 | /// -------------------------------------------------------------------------
17 | /// Simon Pucher 2017
18 | /// -------------------------------------------------------------------------
19 | /// ****** Important ******
20 | /// To compile this script without any error you also need access to the utility indicator to use these global source code elements.
21 | /// You will find this indicator on GitHub: https://raw.githubusercontent.com/simonpucher/AgenaTrader/master/Utilities/GlobalUtilities_Utility.cs
22 | /// -------------------------------------------------------------------------
23 | /// Namespace holds all indicators and is required. Do not change it.
24 | ///
25 | namespace AgenaTrader.UserCode
26 | {
27 | [Description("Phil Town MACD Stocastic EMA.")]
28 | public class Phil_Town_macd_stoc_ma_Indicator : UserIndicator
29 | {
30 |
31 | //private int _period = 10;
32 |
33 | protected override void OnInit()
34 | {
35 | Add(new OutputDescriptor(Color.FromKnownColor(KnownColor.Orange), "Phil_Town_macd_stoc_ema_Plot"));
36 | CalculateOnClosedBar = true;
37 | }
38 |
39 | protected override void OnCalculate()
40 | {
41 | MACD macd = MACD(8, 17, 9);
42 | StochasticsFast stoc = StochasticsFast(5, 14);
43 | EMA ema = EMA(10);
44 |
45 |
46 | //if (macd[0] > macd.Avg[0]) {
47 | // //AddChartArrowUp("ArrowLong_MACD" + +Bars[0].Time.Ticks, this.IsAutoAdjustableScale, 0, Bars[0].Low, Color.Green);
48 | //}
49 |
50 | //if (stoc.K[0] > stoc.D[0])
51 | //{
52 | // //AddChartArrowUp("ArrowLong_STOC" + +Bars[0].Time.Ticks, this.IsAutoAdjustableScale, 0, Bars[0].High, Color.DarkMagenta);
53 | //}
54 |
55 | //if (Bars[0].Close > ema[0])
56 | //{
57 | // //AddChartArrowUp("ArrowLong_EMA" + +Bars[0].Time.Ticks, this.IsAutoAdjustableScale, 0, Bars[0].High - (Bars[0].Range/2), Color.DarkGoldenrod);
58 | //}
59 |
60 |
61 | if (macd[0] > macd.Avg[0] && stoc.K[0] > stoc.D[0] && Bars[0].Close > ema[0])
62 | {
63 | AddChartArrowUp("ArrowLong_philtown" + +Bars[0].Time.Ticks, this.IsAutoAdjustableScale, 0, Bars[0].Low, Color.Green);
64 | MyPlot1[0] = 1;
65 | } else if(macd[0] < macd.Avg[0] && stoc.K[0] < stoc.D[0] && Bars[0].Close < ema[0]){
66 | AddChartArrowDown("ArrowShort_philtown" + +Bars[0].Time.Ticks, this.IsAutoAdjustableScale, 0, Bars[0].High, Color.Red);
67 | MyPlot1[0] = -1;
68 | }
69 | else
70 | {
71 | MyPlot1[0] = 0;
72 | }
73 |
74 | }
75 |
76 | #region Properties
77 |
78 | [Browsable(false)]
79 | [XmlIgnore()]
80 | public DataSeries MyPlot1
81 | {
82 | get { return Outputs[0]; }
83 | }
84 |
85 | /////
86 | /////
87 | //[Description("Select the period for the bullbreath count.")]
88 | //[InputParameter]
89 | //[DisplayName("Period")]
90 | //public int Period
91 | //{
92 | // get { return _period; }
93 | // set
94 | // {
95 | // if (value < 1) value = 1;
96 | // _period = value;
97 | // }
98 | //}
99 |
100 |
101 | public override string ToString()
102 | {
103 | return GetNameOnchart();
104 | }
105 |
106 | public override string DisplayName
107 | {
108 | get
109 | {
110 | return GetNameOnchart();
111 | }
112 | }
113 |
114 |
115 | private string GetNameOnchart()
116 | {
117 | return "Phil Town MACD STOC EMA (I)";
118 | }
119 |
120 | #endregion
121 | }
122 | }
--------------------------------------------------------------------------------
/Tools/Indicator/InstrumentIsInList_tool.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.ComponentModel;
4 | using System.Drawing;
5 | using System.Drawing.Drawing2D;
6 | using System.Linq;
7 | using System.Xml;
8 | using System.Xml.Serialization;
9 | using AgenaTrader.API;
10 | using AgenaTrader.Custom;
11 | using AgenaTrader.Plugins;
12 | using AgenaTrader.Helper;
13 |
14 | ///
15 | /// Version: 1.1
16 | /// -------------------------------------------------------------------------
17 | /// Simon Pucher 2016
18 | /// -------------------------------------------------------------------------
19 | /// Check if the current instrument is in a list.
20 | /// -------------------------------------------------------------------------
21 | /// ****** Important ******
22 | /// To compile this indicator without any error you also need access to the utility indicator to use these global source code elements.
23 | /// You will find this indicator on GitHub: https://raw.githubusercontent.com/simonpucher/AgenaTrader/master/Utilities/GlobalUtilities_Utility.cs
24 | /// -------------------------------------------------------------------------
25 | /// Namespace holds all indicators and is required. Do not change it.
26 | ///
27 | namespace AgenaTrader.UserCode
28 | {
29 |
30 | [Description("Check if the current instrument is in a list.")]
31 | public class InstrumentIsInList_Tool : UserIndicator
32 | {
33 | #region Variables
34 |
35 | private string _instrumentlist = "";
36 | private IInstrumentsList _list = null;
37 |
38 | #endregion
39 |
40 | protected override void OnInit()
41 | {
42 | Add(new OutputDescriptor(Color.FromKnownColor(KnownColor.Orange), "MyPlot1"));
43 | IsOverlay = true;
44 | CalculateOnClosedBar = true;
45 | }
46 |
47 |
48 | protected override void OnCalculate()
49 | {
50 | if (this.IsProcessingBarIndexLast && this.Instrument != null)
51 | {
52 | if (!String.IsNullOrEmpty(Instrumentlist))
53 | {
54 |
55 | this.Root.Core.InstrumentManager.GetInstrumentLists();
56 | _list = this.Root.Core.InstrumentManager.GetInstrumentsListStatic(this.Instrumentlist);
57 |
58 | //if (_list == null)
59 | //{
60 | // _list = this.Root.Core.InstrumentManager.GetInstrumentsListDynamic(this.Name_of_list);
61 | //}
62 | if (_list == null)
63 | {
64 | Log(this.DisplayName + ": The list " + this.Instrumentlist + " does not exist.", InfoLogLevel.Warning);
65 | MyPlot1.Set(-1);
66 | }
67 |
68 | //We have found a list
69 | if (_list.Contains((Instrument)this.Instrument))
70 | {
71 | MyPlot1.Set(1);
72 | }
73 | else
74 | {
75 | MyPlot1.Set(0);
76 | }
77 |
78 | }
79 | else
80 | {
81 | Log(this.DisplayName + ": You need to specify a name for the list.", InfoLogLevel.Warning);
82 | MyPlot1.Set(-1);
83 | }
84 | }
85 |
86 |
87 | //MyPlot1.Set(InSeries[0]);
88 | }
89 |
90 |
91 | public override string DisplayName
92 | {
93 | get
94 | {
95 | return "Instrument is in list (T)";
96 | }
97 | }
98 |
99 |
100 | public override string ToString()
101 | {
102 | return "Instrument is in list (T)";
103 | }
104 |
105 | #region Properties
106 |
107 | [Browsable(false)]
108 | [XmlIgnore()]
109 | public DataSeries MyPlot1
110 | {
111 | get { return Outputs[0]; }
112 | }
113 |
114 | [Description("The name of the static list to which you would like to use.")]
115 | [InputParameter]
116 | [DisplayName("Static list")]
117 | public string Instrumentlist
118 | {
119 | get { return _instrumentlist; }
120 | set { _instrumentlist = value; }
121 | }
122 |
123 | #endregion
124 | }
125 | }
--------------------------------------------------------------------------------
/Indicator/Momentum_Levy_Portfolio_Rank_Indicator.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.ComponentModel;
4 | using System.Drawing;
5 | using System.Drawing.Drawing2D;
6 | using System.Linq;
7 | using System.Xml;
8 | using System.Xml.Serialization;
9 | using AgenaTrader.API;
10 | using AgenaTrader.Custom;
11 | using AgenaTrader.Plugins;
12 | using AgenaTrader.Helper;
13 |
14 | ///
15 | /// Version: 1.5
16 | /// -------------------------------------------------------------------------
17 | /// Simon Pucher 2017
18 | /// -------------------------------------------------------------------------
19 | /// ****** Important ******
20 | /// To compile this script without any error you also need access to the utility indicator to use these global source code elements.
21 | /// You will find this indicator on GitHub: https://raw.githubusercontent.com/simonpucher/AgenaTrader/master/Utilities/GlobalUtilities_Utility.cs
22 | /// -------------------------------------------------------------------------
23 | /// Namespace holds all indicators and is required. Do not change it.
24 | ///
25 | namespace AgenaTrader.UserCode
26 | {
27 | [Description("Enter the description for the new custom indicator here")]
28 | public class Momentum_Levy_Portfolio_Rank_Indicator : UserIndicator
29 | {
30 | public static Dictionary rank_s = null;
31 | public static Dictionary rank_v = null;
32 |
33 | protected override void OnInit()
34 | {
35 | Add(new OutputDescriptor(Color.FromKnownColor(KnownColor.Orange), "Momentum_Levy_Portfolio_Rank_Indicator_Plot"));
36 | //Print("Barscount: " + Bars.Count);
37 | }
38 |
39 | protected override void OnStart()
40 | {
41 | //Print("Barscount: " + Bars.Count, InfoLogLevel.Info);
42 | //foreach (var item in Bars)
43 | //{
44 |
45 | //}
46 |
47 | //Print("OnStart");
48 |
49 | if (rank_s == null)
50 | {
51 | rank_s = new Dictionary();
52 | }
53 |
54 | if (rank_v == null)
55 | {
56 | rank_v = new Dictionary();
57 | }
58 |
59 | RSL rsl = RSL(Closes[0], 27);
60 | rank_s[this.Instrument.Symbol] = rsl[0];
61 |
62 | Volatility_Levy_Stand_Dev_Mean_Average_Indicator vol = Volatility_Levy_Stand_Dev_Mean_Average_Indicator(Closes[0], 27);
63 | rank_v[this.Instrument.Symbol] = vol[0];
64 |
65 | }
66 |
67 | protected override void OnCalculate()
68 | {
69 | //Print("OnCalculate");
70 | int result_s = 0;
71 | int result_v = 0;
72 |
73 | //List> sorted = (from kv in rank orderby kv.Value descending select kv).ToList();
74 |
75 | foreach (KeyValuePair r in rank_s.OrderByDescending(key => key.Value))
76 | {
77 | //Print("Key: {0}, Value: {1}", author.Key, author.Value);
78 | result_s = result_s + 1;
79 | if (this.Instrument.Symbol == r.Key.ToString())
80 | {
81 | break;
82 | }
83 | }
84 |
85 | foreach (KeyValuePair r in rank_v.OrderByDescending(key => key.Value))
86 | {
87 | //Print("Key: {0}, Value: {1}", author.Key, author.Value);
88 | result_v = result_v + 1;
89 | if (this.Instrument.Symbol == r.Key.ToString())
90 | {
91 | break;
92 | }
93 | }
94 |
95 |
96 | //foreach (var key in sorted)
97 | //{
98 | // //Console.WriteLine("{0}: {1}", key, list[key]);
99 | // result = result + 1;
100 | // if (this.Instrument.Symbol == key.ToString())
101 | // {
102 | // break;
103 | // }
104 | //}
105 |
106 | MyPlot1.Set((result_s + result_v)/2);
107 | }
108 |
109 | #region Properties
110 |
111 | [Browsable(false)]
112 | [XmlIgnore()]
113 | public DataSeries MyPlot1
114 | {
115 | get { return Outputs[0]; }
116 | }
117 |
118 | #endregion
119 | }
120 | }
--------------------------------------------------------------------------------
/Indicator/Trendstability_Indicator.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.ComponentModel;
4 | using System.Drawing;
5 | using System.Drawing.Drawing2D;
6 | using System.Linq;
7 | using System.Xml;
8 | using System.Xml.Serialization;
9 | using AgenaTrader.API;
10 | using AgenaTrader.Custom;
11 | using AgenaTrader.Plugins;
12 | using AgenaTrader.Helper;
13 |
14 | ///
15 | /// Version: 1.2
16 | /// -------------------------------------------------------------------------
17 | /// Simon Pucher 2017
18 | /// -------------------------------------------------------------------------
19 | /// ****** Important ******
20 | /// To compile this script without any error you also need access to the utility indicator to use these global source code elements.
21 | /// You will find this indicator on GitHub: https://raw.githubusercontent.com/simonpucher/AgenaTrader/master/Utilities/GlobalUtilities_Utility.cs
22 | /// -------------------------------------------------------------------------
23 | /// Namespace holds all indicators and is required. Do not change it.
24 | ///
25 | namespace AgenaTrader.UserCode
26 | {
27 | [Description("Shows the stability of the trend.")]
28 | public class Trendstability_Indicator : UserIndicator
29 | {
30 |
31 | private MAEnvelopesMAType _MA_1_Selected = MAEnvelopesMAType.SMA;
32 | private int _ma_1 = 100;
33 |
34 | private double GetValue(MAEnvelopesMAType matype, int period, int position)
35 | {
36 | switch (matype)
37 | {
38 | case MAEnvelopesMAType.SMA:
39 | return SMA(period)[position];
40 | case MAEnvelopesMAType.EMA:
41 | return EMA(period)[position];
42 | case MAEnvelopesMAType.WMA:
43 | return WMA(period)[position];
44 | case MAEnvelopesMAType.HMA:
45 | return HMA(period)[position];
46 | case MAEnvelopesMAType.TEMA:
47 | return TEMA(period)[position];
48 | case MAEnvelopesMAType.TMA:
49 | return TMA(period)[position];
50 | default:
51 | throw new NotImplementedException();
52 | }
53 | }
54 |
55 |
56 | protected override void OnInit()
57 | {
58 | Add(new OutputDescriptor(Color.FromKnownColor(KnownColor.Orange), "MyPlot1"));
59 | Add(new OutputDescriptor(Color.FromKnownColor(KnownColor.Gray), "MyPlot2"));
60 | }
61 |
62 | protected override void OnCalculate()
63 | {
64 | if (this.MA_1 != 0 && this.MA_1 > this.RequiredBarsCount)
65 | {
66 | AddChartTextFixed("AlertText", "Required bars must be at least as high as the moving average period.", TextPosition.Center, Color.Red, new Font("Arial", 30), Color.Red, Color.Red, 20);
67 | }
68 |
69 | double resulti = (this.GetValue(this.MA_1_Selected, this.MA_1, 0) - this.GetValue(this.MA_1_Selected, this.MA_1, 1)) / StdDev(this.MA_1)[0] * 100;
70 |
71 | MyPlot1.Set(resulti);
72 | MyPlot2.Set(0);
73 | }
74 |
75 | #region Properties
76 |
77 | [Browsable(false)]
78 | [XmlIgnore()]
79 | public DataSeries MyPlot1
80 | {
81 | get { return Outputs[0]; }
82 | }
83 |
84 | [Browsable(false)]
85 | [XmlIgnore()]
86 | public DataSeries MyPlot2
87 | {
88 | get { return Outputs[1]; }
89 | }
90 |
91 |
92 | ///
93 | ///
94 | [Description("Select the type of MA you would like to use")]
95 | [InputParameter]
96 | [DisplayName("Type of MA")]
97 | public MAEnvelopesMAType MA_1_Selected
98 | {
99 | get { return _MA_1_Selected; }
100 | set
101 | {
102 | _MA_1_Selected = value;
103 | }
104 | }
105 |
106 | ///
107 | ///
108 | [Description("Period for the MA")]
109 | [InputParameter]
110 | [DisplayName("Period MA")]
111 | public int MA_1
112 | {
113 | get { return _ma_1; }
114 | set
115 | {
116 | _ma_1 = value;
117 | }
118 | }
119 |
120 | #endregion
121 | }
122 | }
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | [](https://github.com/simonpucher/AgenaTrader/issues)
2 | [](https://github.com/simonpucher/AgenaTrader/blob/master/LICENSE.md)
3 |
4 | # AgenaTrader Scripts
5 | This project contains scripts for the AgenaTrader like indicators, conditions and strategies. If you have any questions or feedback for us please do not hesitate to contact us via Twitter [Simon](https://twitter.com/SimonPucher), [Christian](https://twitter.com/ckovar82) or [open an issue on GitHub](https://github.com/simonpucher/AgenaTrader/issues).
6 |
7 | ## IMPORTANT
8 | ### AgenaTrader version number
9 | These scripts are compiled against AT Version 2.8.3.1.
10 |
11 | ### Utility Indicator in our Script-Trading Basic-Package
12 | To compile indicators, conditions and other script resources without any error your **AgenaTrader also need access to the Utility Indicator** to use global source code elements! We use this indicator to share code snippets, so we do not need to copy and paste again and again. These reduces error sources, minimze the workload, gives us better testing opportunities and a better clarity. **You need to install the Utility Indicator into your AgenaTrader.**
13 | [You will find the latest version of this Utility Indicator in our free Script-Trading Basic-Package](http://script-trading.com/en/agenatrader/)
14 |
15 | ## Version number vs. in progress
16 | Each script should have a summary tag below the using directives. **If there is a version number you can start using the script.** If there is no summary tag or the version number is a text ("in progress"), we are working on this script and it is not recommended to use it.
17 |
18 | ```C#
19 | ///
20 | /// Version: 1.0
21 | /// -------------------------------------------------------------------------
22 | /// Simon Pucher 2016
23 | /// Christian Kovar 2016
24 | /// -------------------------------------------------------------------------
25 | /// Description: https://en.wikipedia.org/wiki/Algorithmic_trading#Mean_reversion
26 | /// -------------------------------------------------------------------------
27 | /// ****** Important ******
28 | /// To compile this script without any error you also need access to the utility indicator to use these global source code elements.
29 | /// You will find this indicator on GitHub: https://github.com/ScriptTrading/Basic-Package/blob/master/Utilities/GlobalUtilities_Utility.cs
30 | /// -------------------------------------------------------------------------
31 | /// Namespace holds all indicators and is required. Do not change it.
32 | ///
33 | ```
34 |
35 | # Documentation
36 | A rudimentary documentation exists in form of code comments in each script.
37 | We are working on development [tutorials](https://github.com/simonpucher/AgenaTrader/tree/master/Tutorial) with a more detailed documentation and covering the basics for AgenaTrader scripts templates. If you want to help, please feel free to [open an issue on GitHub](https://github.com/simonpucher/AgenaTrader/issues) or fork this project and create a pull request.
38 |
39 | # Installation of AgenaTrader scripts
40 | - Download our Global Utility code bundle [GlobalUtilities_Utility](https://raw.githubusercontent.com/simonpucher/AgenaTrader/master/Utilities/GlobalUtilities_Utility.cs)
41 | - Locate your UserCode directory (e.g. C:\\Users\\yourusername\\Documents\\AgenaTrader\\UserCode)
42 | - Install the Global Utility code bundle into your local \\Indicator folder.
43 | - Download the script you want to use and copy it into the local directory (Indicators into folder \\Indicators, Conditions into folder \\ScriptedConditions, Strategies into folder \\Strategies, Alerts into folder \\AlertHandlers)
44 | - Now you are ready to **click on compile in AgenaTrader** (via menu bar: Strategy Handling => Programming => Compile)
45 |
46 | ## Contact
47 | - [Twitter Simon](https://twitter.com/SimonPucher) [](https://twitter.com/SimonPucher)
48 | - [Twitter Christian](https://twitter.com/ckovar82) [](https://twitter.com/ckovar82)
49 |
50 | ## Links
51 | - [Twitter AgenaTrader](https://twitter.com/AgenaTrader) [](https://twitter.com/AgenaTrader)
52 | - [AgenaTrader Software](http://www.tradeescort.com)
53 | - [AgenaTrader Support Forum](http://www.tradeescort.com/phpbb_de/)
54 | - [GitHub Markdown](https://enterprise.github.com/downloads/en/markdown-cheatsheet.pdf)
55 |
--------------------------------------------------------------------------------
/Indicator/Market_Meanness_Index_Indicator.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.ComponentModel;
4 | using System.Drawing;
5 | using System.Drawing.Drawing2D;
6 | using System.Linq;
7 | using System.Xml;
8 | using System.Xml.Serialization;
9 | using AgenaTrader.API;
10 | using AgenaTrader.Custom;
11 | using AgenaTrader.Plugins;
12 | using AgenaTrader.Helper;
13 |
14 | ///
15 | /// Version: in progress
16 | /// -------------------------------------------------------------------------
17 | /// Simon Pucher 2018
18 | /// -------------------------------------------------------------------------
19 | /// ****** Important ******
20 | /// To compile this script without any error you also need access to the utility indicator to use global source code elements.
21 | /// You will find this script on GitHub: https://raw.githubusercontent.com/simonpucher/AgenaTrader/master/Utilities/GlobalUtilities_Utility.cs
22 | /// -------------------------------------------------------------------------
23 | /// Namespace holds all indicators and is required. Do not change it.
24 | ///
25 | namespace AgenaTrader.UserCode
26 | {
27 | [Description("Market Meanness Index Indicator")]
28 | public class Market_Meanness_Index_Indicator : UserIndicator
29 | {
30 |
31 | bool shortsignalbb = false;
32 | bool longsignalbb = false;
33 |
34 | private int _period = 20;
35 |
36 | private Color _color_long_signal = Const.DefaultArrowLongColor;
37 | private Color _color_short_signal = Const.DefaultArrowShortColor;
38 |
39 | protected override void OnInit()
40 | {
41 | AddOutput(new OutputDescriptor(Color.FromKnownColor(KnownColor.Orange), "Plot_Market_Meanness_Index_Indicator"));
42 | CalculateOnClosedBar = true;
43 | }
44 |
45 | protected override void OnCalculate()
46 | {
47 |
48 |
49 | //double m = Median(Data, TimePeriod);
50 | //int i, nh = 0, nl = 0;
51 | //for (i = 1; i < TimePeriod; i++)
52 | //{
53 | // if (Data[i] > m && Data[i] > Data[i - 1])
54 | // nl++;
55 | // else if (Data[i] < m && Data[i] < Data[i - 1])
56 | // nh++;
57 | //}
58 | //return 100.* (nl + nh) / (TimePeriod - 1);
59 |
60 | double m = Median[this.MMI_Period];
61 | int i, nh = 0, nl = 0;
62 | for (i = 1; i < this.MMI_Period; i++)
63 | {
64 | if (this.InSeries[i] > m && this.InSeries[i] > this.InSeries[i - 1])
65 | nl++;
66 | else if (this.InSeries[i] < m && this.InSeries[i] < this.InSeries[i - 1])
67 | nh++;
68 | }
69 | double resulti = 100.0 * (nl + nh) / (this.MMI_Period - 1);
70 |
71 | MyPlot1.Set(resulti);
72 |
73 |
74 | }
75 |
76 | #region Properties
77 |
78 | [Browsable(false)]
79 | [XmlIgnore()]
80 | public DataSeries MyPlot1
81 | {
82 | get { return Outputs[0]; }
83 | }
84 |
85 |
86 |
87 | ///
88 | ///
89 | [Description("Period.")]
90 | [InputParameter]
91 | [DisplayName("Period")]
92 | public int MMI_Period
93 | {
94 | get { return _period; }
95 | set
96 | {
97 | _period = value;
98 | }
99 | }
100 |
101 |
102 |
103 |
104 | ///
105 | ///
106 | [Description("Select Color for the long signal.")]
107 | [Category("Color")]
108 | [DisplayName("Signal Long")]
109 | public Color ColorLongSignal
110 | {
111 | get { return _color_long_signal; }
112 | set { _color_long_signal = value; }
113 | }
114 |
115 |
116 | // Serialize Color object
117 | [Browsable(false)]
118 | public string ColorLongSignalSerialize
119 | {
120 | get { return SerializableColor.ToString(_color_long_signal); }
121 | set { _color_long_signal = SerializableColor.FromString(value); }
122 | }
123 |
124 | ///
125 | ///
126 | [Description("Select Color for the long signal.")]
127 | [Category("Color")]
128 | [DisplayName("Signal Long")]
129 | public Color ColorShortSignal
130 | {
131 | get { return _color_short_signal; }
132 | set { _color_short_signal = value; }
133 | }
134 |
135 |
136 | // Serialize Color object
137 | [Browsable(false)]
138 | public string ColorShortSignalSerialize
139 | {
140 | get { return SerializableColor.ToString(_color_short_signal); }
141 | set { _color_short_signal = SerializableColor.FromString(value); }
142 | }
143 |
144 | #endregion
145 | }
146 | }
--------------------------------------------------------------------------------
/Tools/TaiPan/TaiPan_Data_Access_CSharp/Forms_Application/Forms_Application.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Debug
6 | AnyCPU
7 | {F4F42A38-3BE9-4D10-85B0-ECE2AA6CE577}
8 | WinExe
9 | Properties
10 | WindowsFormsApplication1
11 | WindowsFormsApplication1
12 | v4.5
13 | 512
14 |
15 |
16 |
17 | AnyCPU
18 | true
19 | full
20 | false
21 | bin\Debug\
22 | DEBUG;TRACE
23 | prompt
24 | 4
25 |
26 |
27 | AnyCPU
28 | pdbonly
29 | true
30 | bin\Release\
31 | TRACE
32 | prompt
33 | 4
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 | Form
50 |
51 |
52 | Main.cs
53 |
54 |
55 |
56 |
57 | Main.cs
58 |
59 |
60 | ResXFileCodeGenerator
61 | Resources.Designer.cs
62 | Designer
63 |
64 |
65 | True
66 | Resources.resx
67 | True
68 |
69 |
70 | SettingsSingleFileGenerator
71 | Settings.Designer.cs
72 |
73 |
74 | True
75 | Settings.settings
76 | True
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 | {00020430-0000-0000-C000-000000000046}
85 | 2
86 | 0
87 | 0
88 | primary
89 | False
90 | True
91 |
92 |
93 | {6940CFB8-A98A-11D3-80FA-00105A66FB37}
94 | 1
95 | 0
96 | 0
97 | tlbimp
98 | False
99 | False
100 |
101 |
102 |
103 |
110 |
--------------------------------------------------------------------------------
/Condition/TrendTemplate_MarkMinervini_Condition.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.ComponentModel;
4 | using System.Drawing;
5 | using System.Drawing.Drawing2D;
6 | using System.Linq;
7 | using System.Xml;
8 | using System.Xml.Serialization;
9 | using AgenaTrader.API;
10 | using AgenaTrader.Custom;
11 | using AgenaTrader.Plugins;
12 | using AgenaTrader.Helper;
13 |
14 | ///
15 | /// Version: 1.1.0
16 | /// -------------------------------------------------------------------------
17 | /// Simon Pucher 2016
18 | /// -------------------------------------------------------------------------
19 | /// This indicator provides trend template by Mark Minervini signals http://www.stockfetcher.com/forums2/Filter-Exchange/Trend-Template-by-Mark-Minervini/125969
20 | /// -------------------------------------------------------------------------
21 | /// ****** Important ******
22 | /// To compile this script without any error you also need access to the utility indicator to use global source code elements.
23 | /// You will find this script on GitHub: https://github.com/simonpucher/AgenaTrader/blob/master/Utility/GlobalUtilities_Utility.cs
24 | /// -------------------------------------------------------------------------
25 | /// Namespace holds all indicators and is required. Do not change it.
26 | ///
27 | namespace AgenaTrader.UserCode
28 | {
29 | [Category("Script-Trading")]
30 | [Description("Geben Sie bitte hier die Beschreibung für die neue Condition ein")]
31 | [IsEntryAttribute(true)]
32 | [IsStopAttribute(false)]
33 | [IsTargetAttribute(false)]
34 | [OverrulePreviousStopPrice(false)]
35 | public class TrendTemplate_MarkMinervini_Condition : UserScriptedCondition
36 | {
37 | //input
38 |
39 |
40 | //output
41 |
42 |
43 | //internal
44 | private bool ErrorOccured = false;
45 | private TrendTemplate_MarkMinervini_Indicator _TrendTemplate_MarkMinervini_Indicator = null;
46 |
47 |
48 | protected override void OnInit()
49 | {
50 | IsEntry = true;
51 | IsStop = false;
52 | IsTarget = false;
53 | Add(new OutputDescriptor(Const.DefaultIndicatorColor, "Occurred"));
54 | Add(new OutputDescriptor(Const.DefaultIndicatorColor, "Entry"));
55 |
56 | IsOverlay = false;
57 | CalculateOnClosedBar = true;
58 |
59 | //We need at least xy bars
60 | this.RequiredBarsCount = 130;
61 |
62 | }
63 |
64 |
65 | protected override void OnStart()
66 | {
67 | base.OnStart();
68 |
69 | //Init our indicator to get code access to the calculate method
70 | this._TrendTemplate_MarkMinervini_Indicator = new TrendTemplate_MarkMinervini_Indicator();
71 |
72 | this.ErrorOccured = false;
73 | }
74 |
75 |
76 |
77 | protected override void OnCalculate()
78 | {
79 |
80 | //calculate data
81 | ResultValue returnvalue = this._TrendTemplate_MarkMinervini_Indicator.calculate(this.InSeries);
82 |
83 | //If the calculate method was not finished we need to stop and show an alert message to the user.
84 | if (returnvalue.ErrorOccured)
85 | {
86 | //Display error just one time
87 | if (!this.ErrorOccured)
88 | {
89 | Log(this.DisplayName + ": " + Const.DefaultStringErrorDuringCalculation, InfoLogLevel.AlertLog);
90 | this.ErrorOccured = true;
91 | }
92 | return;
93 | }
94 |
95 |
96 | //Entry
97 | if (returnvalue.Entry.HasValue)
98 | {
99 | switch (returnvalue.Entry)
100 | {
101 | case OrderDirection.Buy:
102 | Occurred.Set(1);
103 | break;
104 | }
105 | }
106 | else
107 | {
108 | Occurred.Set(0);
109 | }
110 |
111 | }
112 |
113 |
114 | public override string ToString()
115 | {
116 | return "TT Mark Minervini (C)";
117 | }
118 |
119 | public override string DisplayName
120 | {
121 | get
122 | {
123 | return "TT Mark Minervini (C)";
124 | }
125 | }
126 |
127 |
128 |
129 |
130 |
131 | #region InSeries
132 |
133 | [Browsable(false)]
134 | [XmlIgnore()]
135 | public DataSeries Occurred
136 | {
137 | get { return Outputs[0]; }
138 | }
139 |
140 | [Browsable(false)]
141 | [XmlIgnore()]
142 | public DataSeries Entry
143 | {
144 | get { return Outputs[1]; }
145 | }
146 |
147 | public override IList GetEntries()
148 | {
149 | return new[] { Entry };
150 | }
151 |
152 |
153 | #endregion
154 | }
155 | }
--------------------------------------------------------------------------------
/Condition/Holy_Grail_Condition.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.ComponentModel;
4 | using System.Drawing;
5 | using System.Drawing.Drawing2D;
6 | using System.Linq;
7 | using System.Xml;
8 | using System.Xml.Serialization;
9 | using AgenaTrader.API;
10 | using AgenaTrader.Custom;
11 | using AgenaTrader.Plugins;
12 | using AgenaTrader.Helper;
13 |
14 | ///
15 | /// Version: 1.2
16 | /// -------------------------------------------------------------------------
17 | /// Simon Pucher 2016
18 | /// -------------------------------------------------------------------------
19 | /// Description http://lindaraschke.net/wp-content/uploads/2013/11/august1997.pdf
20 | /// -------------------------------------------------------------------------
21 | /// ****** Important ******
22 | /// To compile this script without any error you also need access to the utility indicator to use global source code elements.
23 | /// You will find this script on GitHub: https://raw.githubusercontent.com/simonpucher/AgenaTrader/master/Utilities/GlobalUtilities_Utility.cs
24 | /// -------------------------------------------------------------------------
25 | /// Namespace holds all indicators and is required. Do not change it.
26 | ///
27 | namespace AgenaTrader.UserCode
28 | {
29 | [Category("Script-Trading")]
30 | [Description("Watch out for the lonely warrior behind enemy lines.")]
31 | [IsEntryAttribute(true)]
32 | [IsStopAttribute(false)]
33 | [IsTargetAttribute(false)]
34 | [OverrulePreviousStopPrice(false)]
35 | public class Holy_Grail_Condition : UserScriptedCondition
36 | {
37 | #region Variables
38 |
39 | private Color _plot0color = Color.Orange;
40 | private int _plot0width = 1;
41 | private DashStyle _plot0dashstyle = DashStyle.Solid;
42 |
43 | #endregion
44 |
45 |
46 |
47 |
48 | protected override void OnInit()
49 | {
50 | IsEntry = true;
51 | IsStop = false;
52 | IsTarget = false;
53 |
54 | Add(new OutputDescriptor(this.Plot0Color, "Occurred"));
55 | Add(new OutputDescriptor(this.Plot0Color, "Entry"));
56 |
57 | IsOverlay = false;
58 | CalculateOnClosedBar = true;
59 | }
60 |
61 | protected override void OnCalculate()
62 | {
63 |
64 |
65 | double rv = 0;
66 | if (LeadIndicator.Holy_Grail_Indicator(this.InSeries)[0] > 0 && LeadIndicator.Holy_Grail_Indicator(this.InSeries)[1] > 0 && LeadIndicator.Holy_Grail_Indicator(this.InSeries)[3] > 0)
67 | {
68 | rv = 1 ;
69 | }
70 |
71 |
72 | Occurred.Set(rv);
73 |
74 | PlotColors[0][0] = this.Plot0Color;
75 | OutputDescriptors[0].PenStyle = this.Dash0Style;
76 | OutputDescriptors[0].Pen.Width = this.Plot0Width;
77 |
78 | }
79 |
80 |
81 | public override string DisplayName
82 | {
83 | get
84 | {
85 | return "Holy Grail (C)";
86 | }
87 | }
88 |
89 |
90 | public override string ToString()
91 | {
92 | return "Holy Grail (C)";
93 | }
94 |
95 |
96 | #region Properties
97 |
98 | [Browsable(false)]
99 | [XmlIgnore()]
100 | public DataSeries Occurred
101 | {
102 | get { return Outputs[0]; }
103 | }
104 |
105 | [Browsable(false)]
106 | [XmlIgnore()]
107 | public DataSeries Entry
108 | {
109 | get { return Outputs[1]; }
110 | }
111 |
112 | public override IList GetEntries()
113 | {
114 | return new[]{Entry};
115 | }
116 |
117 |
118 | ///
119 | ///
120 | [Description("Select Color for the indicator.")]
121 | [Category("Plots")]
122 | [DisplayName("High line color")]
123 | public Color Plot0Color
124 | {
125 | get { return _plot0color; }
126 | set { _plot0color = value; }
127 | }
128 | // Serialize Color object
129 | [Browsable(false)]
130 | public string Plot0ColorSerialize
131 | {
132 | get { return SerializableColor.ToString(_plot0color); }
133 | set { _plot0color = SerializableColor.FromString(value); }
134 | }
135 |
136 | ///
137 | ///
138 | [Description("Line width for indicator.")]
139 | [Category("Plots")]
140 | [DisplayName("High line width")]
141 | public int Plot0Width
142 | {
143 | get { return _plot0width; }
144 | set { _plot0width = Math.Max(1, value); }
145 | }
146 |
147 | ///
148 | ///
149 | [Description("DashStyle for indicator.")]
150 | [Category("Plots")]
151 | [DisplayName("High line dash style")]
152 | public DashStyle Dash0Style
153 | {
154 | get { return _plot0dashstyle; }
155 | set { _plot0dashstyle = value; }
156 | }
157 |
158 | #endregion
159 | }
160 | }
--------------------------------------------------------------------------------
/Tools/Indicator/Change_quantity_by_click_tool.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.ComponentModel;
4 | using System.Drawing;
5 | using System.Drawing.Drawing2D;
6 | using System.Linq;
7 | using System.Xml;
8 | using System.Xml.Serialization;
9 | using AgenaTrader.API;
10 | using AgenaTrader.Custom;
11 | using AgenaTrader.Plugins;
12 | using AgenaTrader.Helper;
13 | using AgenaTrader.Helper.TradingManager;
14 |
15 |
16 | ///
17 | /// Version: 1.2
18 | /// -------------------------------------------------------------------------
19 | /// Simon Pucher 2016
20 | /// -------------------------------------------------------------------------
21 | /// Changes the quantity of an order by clicking on the chart.
22 | /// -------------------------------------------------------------------------
23 | /// ****** Important ******
24 | /// To compile this indicator without any error you also need access to the utility indicator to use these global source code elements.
25 | /// You will find this indicator on GitHub: https://raw.githubusercontent.com/simonpucher/AgenaTrader/master/Utilities/GlobalUtilities_Utility.cs
26 | /// -------------------------------------------------------------------------
27 | /// Namespace holds all indicators and is required. Do not change it.
28 | ///
29 | namespace AgenaTrader.UserCode
30 | {
31 |
32 | [Description("Changes the quantity of an order by clicking on the chart.")]
33 | public class ChangeQuantity_Tool : UserIndicator
34 | {
35 | #region Variables
36 |
37 | private OrdersLogFilter olf = new OrdersLogFilter();
38 |
39 | #endregion
40 |
41 | protected override void OnInit()
42 | {
43 | Add(new OutputDescriptor(Color.FromKnownColor(KnownColor.Transparent), "MyPlot1"));
44 | IsOverlay = true;
45 | CalculateOnClosedBar = true;
46 | }
47 |
48 |
49 | protected override void OnStart()
50 | {
51 |
52 | // Add event listener
53 | if (Chart != null)
54 | Chart.ChartPanelMouseDown += OnChartPanelMouseDown;
55 |
56 | //Init Filter
57 | olf.Instruments = new List();
58 | olf.Instruments.Add(this.Instrument);
59 |
60 | }
61 |
62 |
63 |
64 | protected override void OnCalculate()
65 | {
66 | MyPlot1.Set(InSeries[0]);
67 | }
68 |
69 |
70 | protected override void OnDispose()
71 | {
72 | // Remove event listener
73 | if (Chart != null)
74 | Chart.ChartPanelMouseDown -= OnChartPanelMouseDown;
75 | }
76 |
77 |
78 | private void OnChartPanelMouseDown(object sender, System.Windows.Forms.MouseEventArgs e)
79 | {
80 |
81 | if (e.Button == System.Windows.Forms.MouseButtons.Left)
82 | {
83 | //Get the last order where IsProposal is true.
84 | if (this.TradingManager != null && olf != null && this.Instrument != null)
85 | {
86 | IEnumerable olren = this.TradingManager.GetOrdersLog(olf).Where(x => x.Instrument.Id == this.Instrument.Id).Where(x => x.IsProposal == true).Where(x=>x.State == OrderState.PendingSubmit);
87 | List hhh = olren.ToList();
88 | OrdersLogRecord olr = olren.LastOrDefault();
89 | if (olr != null)
90 | {
91 | //Cast the order
92 | Order ord = (Order)this.TradingManager.GetOrder(olr.OrderId);
93 | if (ord != null && ord.State == OrderState.PendingSubmit)
94 | {
95 | //Change quantity
96 | double clickprice = Chart.GetPriceByY(e.Y);
97 | if (clickprice >= ord.Price + (ord.Price/100*1) )
98 | {
99 | ord.Quantity = ord.Quantity + 1;
100 | this.TradingManager.EditOrder(ord);
101 | }
102 | else if (clickprice <= ord.Price - (ord.Price/100*1))
103 | {
104 | if (ord.Quantity > 1)
105 | {
106 | ord.Quantity = ord.Quantity - 1;
107 | this.TradingManager.EditOrder(ord);
108 | }
109 | }
110 | }
111 | }
112 | }
113 | }
114 | }
115 |
116 |
117 | public override string ToString()
118 | {
119 | return "Change quantity (T)";
120 | }
121 |
122 | public override string DisplayName
123 | {
124 | get
125 | {
126 | return "Change quantity (T)";
127 | }
128 | }
129 |
130 |
131 | #region Properties
132 |
133 | [Browsable(false)]
134 | [XmlIgnore()]
135 | public DataSeries MyPlot1
136 | {
137 | get { return Outputs[0]; }
138 | }
139 |
140 | #endregion
141 | }
142 | }
--------------------------------------------------------------------------------
/Indicator/Elder_Ray_Bull_and_Bear_Power_Indicator.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.ComponentModel;
4 | using System.Drawing;
5 | using System.Drawing.Drawing2D;
6 | using System.Linq;
7 | using System.Xml;
8 | using System.Xml.Serialization;
9 | using AgenaTrader.API;
10 | using AgenaTrader.Custom;
11 | using AgenaTrader.Plugins;
12 | using AgenaTrader.Helper;
13 |
14 | ///
15 | /// Version: 1.2.0
16 | /// -------------------------------------------------------------------------
17 | /// Simon Pucher 2017
18 | /// -------------------------------------------------------------------------
19 | /// http://vtadwiki.vtad.de/index.php/Elder_Ray_-_Bull_and_Bear_Power
20 | /// -------------------------------------------------------------------------
21 | /// ****** Important ******
22 | /// To compile this script without any error you also need access to the utility indicator to use global source code elements.
23 | /// You will find this script on GitHub: https://raw.githubusercontent.com/simonpucher/AgenaTrader/master/Utilities/GlobalUtilities_Utility.cs
24 | /// -------------------------------------------------------------------------
25 | /// Namespace holds all indicators and is required. Do not change it.
26 | ///
27 | namespace AgenaTrader.UserCode
28 | {
29 |
30 | public enum ElderRayTyp {
31 | BullPower = 0,
32 | BearPower = 1
33 | }
34 |
35 | [Description("Elder Ray - Bull and Bear Power")]
36 | public class Elder_Ray_Bull_and_Bear_Power_Indicator : UserIndicator
37 | {
38 | private int _period = 13;
39 | private ElderRayTyp _ElderRayTyp = ElderRayTyp.BullPower;
40 |
41 | private DoubleSeries ds_bull_power;
42 | private DoubleSeries ds_bear_power;
43 |
44 |
45 | protected override void OnInit()
46 | {
47 | Add(new OutputDescriptor(Color.FromKnownColor(KnownColor.Gray), "bull_power"));
48 | Add(new OutputDescriptor(Color.FromKnownColor(KnownColor.Gray), "bear_power"));
49 |
50 | ds_bull_power = new DoubleSeries(this);
51 | ds_bear_power = new DoubleSeries(this);
52 | }
53 |
54 | protected override void OnCalculate()
55 | {
56 | EMA ema = EMA(this.Period);
57 | double bull_power = High[0] - ema[0];
58 | double bear_power = Low[0] - ema[0];
59 | ds_bull_power.Set(bull_power);
60 | ds_bear_power.Set(bear_power);
61 |
62 | if (_ElderRayTyp == ElderRayTyp.BullPower)
63 | {
64 | MyPlot1.Set(bull_power);
65 | }
66 | else
67 | {
68 | MyPlot2.Set(bear_power);
69 | }
70 |
71 |
72 | //Set the color
73 | if (ema[0] > ema[1])
74 | {
75 | PlotColors[0][0] = Color.Green;
76 | OutputDescriptors[0].Pen.Width = 2;
77 | }
78 | else
79 | {
80 | PlotColors[0][0] = Color.Red;
81 | OutputDescriptors[0].Pen.Width = 1;
82 | }
83 | OutputDescriptors[0].PenStyle = DashStyle.Solid;
84 | OutputDescriptors[0].OutputSerieDrawStyle = OutputSerieDrawStyle.Bar;
85 |
86 | if (ema[0] < ema[1])
87 | {
88 | PlotColors[1][0] = Color.Red;
89 | OutputDescriptors[1].Pen.Width = 2;
90 | }
91 | else
92 | {
93 | PlotColors[1][0] = Color.Green;
94 | OutputDescriptors[1].Pen.Width = 1;
95 | }
96 | OutputDescriptors[1].PenStyle = DashStyle.Solid;
97 | OutputDescriptors[1].OutputSerieDrawStyle = OutputSerieDrawStyle.Bar;
98 |
99 | if (ema[0] > ema[1] && bear_power < 0 && bear_power > ds_bear_power.Get(1))
100 | {
101 | AddChartArrowUp("ArrowLong" +Bars[0].Time.Ticks, this.IsAutoAdjustableScale, 0, Bars[0].Low, Color.LightGreen);
102 | }
103 |
104 | if (ema[0] < ema[1] && bull_power > 0 && bull_power < ds_bull_power.Get(1))
105 | {
106 | AddChartArrowDown("ArrowShort" + Bars[0].Time.Ticks, this.IsAutoAdjustableScale, 0, Bars[0].High, Color.Red);
107 | }
108 |
109 | }
110 |
111 |
112 | public override string DisplayName
113 | {
114 | get
115 | {
116 | return "Elder Ray (I)";
117 | }
118 | }
119 |
120 |
121 | public override string ToString()
122 | {
123 | return "Elder Ray (I)";
124 |
125 | }
126 |
127 | #region Properties
128 |
129 | [Browsable(false)]
130 | [XmlIgnore()]
131 | public DataSeries MyPlot1
132 | {
133 | get { return Outputs[0]; }
134 | }
135 |
136 | [Browsable(false)]
137 | [XmlIgnore()]
138 | public DataSeries MyPlot2
139 | {
140 | get { return Outputs[1]; }
141 | }
142 |
143 | [Description("Type of ElderRayTyp.")]
144 | [InputParameter]
145 | [DisplayName("ElderRayTyp")]
146 | public ElderRayTyp ElderRayTyp
147 | {
148 | get { return _ElderRayTyp; }
149 | set { _ElderRayTyp = value; }
150 |
151 | }
152 | [Description("Period of the EMA.")]
153 | [InputParameter]
154 | [DisplayName("Period")]
155 | public int Period
156 | {
157 | get { return _period; }
158 | set { _period = value; }
159 |
160 | }
161 | #endregion
162 | }
163 | }
--------------------------------------------------------------------------------
/Strategy/Reversal2NextBar_Strategy.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.ComponentModel;
4 | using System.Drawing;
5 | using System.Drawing.Drawing2D;
6 | using System.Linq;
7 | using System.Xml;
8 | using System.Xml.Serialization;
9 | using AgenaTrader.API;
10 | using AgenaTrader.Custom;
11 | using AgenaTrader.Plugins;
12 | using AgenaTrader.Helper;
13 | using AgenaTrader.Helper.TradingManager;
14 |
15 | ///
16 | /// Version: in progress
17 | /// -------------------------------------------------------------------------
18 | /// Christian Kovar 2016
19 | /// -------------------------------------------------------------------------
20 | /// todo description
21 | /// -------------------------------------------------------------------------
22 | /// ****** Important ******
23 | /// To compile this script without any error you also need access to the utility indicator to use global source code elements.
24 | /// You will find this script on GitHub: https://raw.githubusercontent.com/simonpucher/AgenaTrader/master/Utilities/GlobalUtilities_Utility.cs
25 | /// -------------------------------------------------------------------------
26 | /// Namespace holds all indicators and is required. Do not change it.
27 | ///
28 | namespace AgenaTrader.UserCode
29 | {
30 | [Description("Kauft bei Umkehrstab und hält für eine Periode")]
31 | public class Reversal2NextBar_Strategy : UserStrategy
32 | {
33 | #region Variables
34 | bool _testlauf = false;
35 | double Reversal_Indicator_Value;
36 |
37 | private IOrder oEnter;
38 | private IOrder oStop;
39 |
40 | string SignalNameEnter;
41 | string SignalNameStop;
42 | #endregion
43 |
44 |
45 |
46 | protected override void OnInit()
47 | {
48 | CalculateOnClosedBar = true;
49 | IsAutoConfirmOrder = false;
50 | }
51 |
52 | protected override void OnCalculate()
53 | {
54 | string ocoId;
55 | double StopForReversalTrade;
56 |
57 | if (!IsProcessingBarIndexLast || oEnter != null)
58 | {
59 | return;
60 | }
61 |
62 |
63 | if (_testlauf == false)
64 | {
65 | //Reversal_Indicator_Value aufrufen. Dieser liefert 100 für Long Einstieg und -100 für Short Einstieg. Liefert 0 für kein Einstiegssignal
66 | Reversal_Indicator_Value = Reversal2NextBar_Indicator()[0];
67 | Print(Bars[0].Time + " RevIndVal: " + Reversal_Indicator_Value);
68 | StopForReversalTrade = Reversal2NextBar_Indicator().getReversalStop();
69 |
70 | }
71 | else
72 | {
73 | Reversal_Indicator_Value = 100;
74 | StopForReversalTrade = (Bars[ProcessingBarIndex].Close - 50 * TickSize);
75 | }
76 |
77 |
78 | if (Reversal_Indicator_Value == 100)
79 | {
80 | //Long
81 | SignalNameEnter = "ReversalLong" + Bars[0].Time;
82 | SignalNameStop = "ReversalStop" + Bars[0].Time;
83 | ocoId = "ReversalLong_ocoID" + Bars[0].Time;
84 | oEnter = SubmitOrder(0, OrderDirection.Buy, OrderType.Market, 3, 0, 0, ocoId, SignalNameEnter);
85 | oStop = SubmitOrder(0, OrderDirection.Sell, OrderType.Stop, 3, 0, StopForReversalTrade, ocoId, SignalNameStop);
86 | }
87 | else if (Reversal_Indicator_Value == -100)
88 | {
89 | //Short
90 | SignalNameEnter = "ReversalShort" + Bars[0].Time;
91 | SignalNameStop = "ReversalStop" + Bars[0].Time;
92 | ocoId = "ReversalShort_ocoID" + Bars[0].Time;
93 | oEnter = SubmitOrder(0, OrderDirection.Sell, OrderType.Market, 3, 0, 0, ocoId, SignalNameEnter);
94 | oStop = SubmitOrder(0, OrderDirection.Buy, OrderType.Stop, 3, 0, StopForReversalTrade, ocoId, SignalNameStop);
95 | }
96 | else
97 | {
98 | //keine Aktion
99 | return;
100 | }
101 |
102 | CreateIfDoneGroup(new List { oEnter, oStop });
103 | oEnter.ConfirmOrder();
104 | }
105 |
106 |
107 | protected override void OnOrderExecution(IExecution execution)
108 | {
109 | DateTime ts_Ausstieg;
110 |
111 | // ts_Ausstieg = Reversal2NextBar_Indicator().GetTargetBar(Bars[-1].Timestamp);
112 | ts_Ausstieg = GlobalUtilities.GetTargetBar(Bars, Bars[0].Time, TimeFrame, 1);
113 | Print("Ausstieg: " + ts_Ausstieg + "Bars[-1].Time: " + Bars[-1].Time);
114 |
115 | ////todo this is not working in 1.9
116 | //foreach (Trade item in this.Root.Core.TradingManager.ActiveOpenedTrades)
117 | //{
118 | // if (item.EntryOrder.Name == SignalNameEnter
119 | // || item.EntryOrder.Name == SignalNameStop)
120 | // {
121 | // item.Expiration = ts_Ausstieg;
122 | // }
123 | //}
124 |
125 |
126 | if (execution.PositionType == PositionType.Flat)
127 | {
128 | oStop = null; //den Stop zuerst
129 | oEnter = null;
130 | }
131 | }
132 |
133 | #region Properties
134 | [Description("Testlauf")]
135 | [InputParameter]
136 | [DisplayName("Testlauf")]
137 | public bool Testlauf
138 | {
139 | get { return _testlauf; }
140 | set { _testlauf = value; }
141 | }
142 | #endregion
143 |
144 | }
145 | }
146 |
--------------------------------------------------------------------------------
/Tools/TaiPan/TaiPan_Data_Access_CSharp/Forms_Application/Properties/Resources.resx:
--------------------------------------------------------------------------------
1 |
2 |
3 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 | text/microsoft-resx
107 |
108 |
109 | 2.0
110 |
111 |
112 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
113 |
114 |
115 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
116 |
117 |
--------------------------------------------------------------------------------
/Indicator/Trendstrength_Indicator.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.ComponentModel;
4 | using System.Drawing;
5 | using System.Drawing.Drawing2D;
6 | using System.Linq;
7 | using System.Xml;
8 | using System.Xml.Serialization;
9 | using AgenaTrader.API;
10 | using AgenaTrader.Custom;
11 | using AgenaTrader.Plugins;
12 | using AgenaTrader.Helper;
13 |
14 | ///
15 | /// Version: 1.2
16 | /// -------------------------------------------------------------------------
17 | /// Simon Pucher 2017
18 | /// -------------------------------------------------------------------------
19 | /// ****** Important ******
20 | /// To compile this script without any error you also need access to the utility indicator to use these global source code elements.
21 | /// You will find this indicator on GitHub: https://raw.githubusercontent.com/simonpucher/AgenaTrader/master/Utilities/GlobalUtilities_Utility.cs
22 | /// -------------------------------------------------------------------------
23 | /// Namespace holds all indicators and is required. Do not change it.
24 | ///
25 | namespace AgenaTrader.UserCode
26 | {
27 | [Description("Shows the strength of the trend.")]
28 | public class Trendstrength_Indicator : UserIndicator
29 | {
30 | private MAEnvelopesMAType _MA_1_Selected = MAEnvelopesMAType.SMA;
31 | private int _ma_1 = 100;
32 | private MAEnvelopesMAType _MA_2_Selected = MAEnvelopesMAType.SMA;
33 | private int _ma_2 = 20;
34 | private int _multiplier = 5;
35 |
36 | private double GetValue(MAEnvelopesMAType matype, int period, int position)
37 | {
38 | switch (matype)
39 | {
40 | case MAEnvelopesMAType.SMA:
41 | return SMA(period)[position];
42 | case MAEnvelopesMAType.EMA:
43 | return EMA(period)[position];
44 | case MAEnvelopesMAType.WMA:
45 | return WMA(period)[position];
46 | case MAEnvelopesMAType.HMA:
47 | return HMA(period)[position];
48 | case MAEnvelopesMAType.TEMA:
49 | return TEMA(period)[position];
50 | case MAEnvelopesMAType.TMA:
51 | return TMA(period)[position];
52 | default:
53 | throw new NotImplementedException();
54 | }
55 | }
56 |
57 | protected override void OnInit()
58 | {
59 | Add(new OutputDescriptor(Color.FromKnownColor(KnownColor.Orange), "MyPlot1"));
60 | Add(new OutputDescriptor(Color.FromKnownColor(KnownColor.Gray), "MyPlot2"));
61 | }
62 |
63 | protected override void OnCalculate()
64 | {
65 | if (this.MA_1 != 0 && this.MA_1 > this.RequiredBarsCount)
66 | {
67 | AddChartTextFixed("AlertText", "Required bars must be at least as high as the largest moving average period.", TextPosition.Center, Color.Red, new Font("Arial", 30), Color.Red, Color.Red, 20);
68 | }
69 |
70 | //double resulti = (this.GetValue(this.MA_1_Selected, this.MA_1, 0) - this.GetValue(this.MA_1_Selected, this.MA_1, 1)) / StdDev(this.MA_1)[0] * 100;
71 |
72 | double perc1 = (this.GetValue(this.MA_1_Selected, this.MA_1, 0) - this.GetValue(this.MA_1_Selected, this.MA_1, 1)) / (this.GetValue(this.MA_1_Selected, this.MA_1, 1) / 100);
73 | double perc2 = (this.GetValue(this.MA_2_Selected, this.MA_2, 0) - this.GetValue(this.MA_2_Selected, this.MA_2, 1)) / (this.GetValue(this.MA_2_Selected, this.MA_2, 1) / 100);
74 |
75 | double resulti = perc1 * this.Multiplier + perc2;
76 |
77 | MyPlot1.Set(resulti);
78 | MyPlot2.Set(0);
79 | }
80 |
81 | #region Properties
82 |
83 | [Browsable(false)]
84 | [XmlIgnore()]
85 | public DataSeries MyPlot1
86 | {
87 | get { return Outputs[0]; }
88 | }
89 |
90 | [Browsable(false)]
91 | [XmlIgnore()]
92 | public DataSeries MyPlot2
93 | {
94 | get { return Outputs[1]; }
95 | }
96 |
97 | ///
98 | ///
99 | [Description("Select the type of MA1 you would like to use")]
100 | [InputParameter]
101 | [DisplayName("Type of MA1")]
102 | public MAEnvelopesMAType MA_1_Selected
103 | {
104 | get { return _MA_1_Selected; }
105 | set
106 | {
107 | _MA_1_Selected = value;
108 | }
109 | }
110 |
111 | ///
112 | ///
113 | [Description("Period for the MA1")]
114 | [InputParameter]
115 | [DisplayName("Period MA1")]
116 | public int MA_1
117 | {
118 | get { return _ma_1; }
119 | set
120 | {
121 | _ma_1 = value;
122 | }
123 | }
124 |
125 | ///
126 | ///
127 | [Description("Select the type of MA2 you would like to use")]
128 | [InputParameter]
129 | [DisplayName("Type of MA2")]
130 | public MAEnvelopesMAType MA_2_Selected
131 | {
132 | get { return _MA_2_Selected; }
133 | set
134 | {
135 | _MA_2_Selected = value;
136 | }
137 | }
138 |
139 | ///
140 | ///
141 | [Description("Period for the MA2")]
142 | [InputParameter]
143 | [DisplayName("Period MA2")]
144 | public int MA_2
145 | {
146 | get { return _ma_2; }
147 | set
148 | {
149 | _ma_2 = value;
150 | }
151 | }
152 |
153 | ///
154 | ///
155 | [Description("Multiplier")]
156 | [InputParameter]
157 | [DisplayName("Multiplier")]
158 | public int Multiplier
159 | {
160 | get { return _multiplier; }
161 | set
162 | {
163 | _multiplier = value;
164 | }
165 | }
166 |
167 | #endregion
168 | }
169 | }
--------------------------------------------------------------------------------
/Tools/TaiPan/TaiPan_Data_Access_CSharp/Forms_Application/Main.resx:
--------------------------------------------------------------------------------
1 |
2 |
3 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 | text/microsoft-resx
110 |
111 |
112 | 2.0
113 |
114 |
115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
116 |
117 |
118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
119 |
120 |
--------------------------------------------------------------------------------
/Condition/Lonely_Warrior_Condition.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.ComponentModel;
4 | using System.Drawing;
5 | using System.Drawing.Drawing2D;
6 | using System.Linq;
7 | using System.Xml;
8 | using System.Xml.Serialization;
9 | using AgenaTrader.API;
10 | using AgenaTrader.Custom;
11 | using AgenaTrader.Plugins;
12 | using AgenaTrader.Helper;
13 |
14 | ///
15 | /// Version: 1.1
16 | /// -------------------------------------------------------------------------
17 | /// Simon Pucher 2016
18 | /// -------------------------------------------------------------------------
19 | /// Inspired by https://www.youtube.com/watch?v=Qj_6DFTNfjE
20 | /// -------------------------------------------------------------------------
21 | /// ****** Important ******
22 | /// To compile this script without any error you also need access to the utility indicator to use global source code elements.
23 | /// You will find this script on GitHub: https://raw.githubusercontent.com/simonpucher/AgenaTrader/master/Utilities/GlobalUtilities_Utility.cs
24 | /// -------------------------------------------------------------------------
25 | /// Namespace holds all indicators and is required. Do not change it.
26 | ///
27 | namespace AgenaTrader.UserCode
28 | {
29 | [Category("Script-Trading")]
30 | [Description("Watch out for the lonely warrior behind enemy lines.")]
31 | [IsEntryAttribute(true)]
32 | [IsStopAttribute(false)]
33 | [IsTargetAttribute(false)]
34 | [OverrulePreviousStopPrice(false)]
35 | public class Lonely_Warrior_Condition : UserScriptedCondition
36 | {
37 | #region Variables
38 |
39 | private Color _plot0color = Const.DefaultIndicatorColor;
40 | private int _plot0width = Const.DefaultLineWidth;
41 | private DashStyle _plot0dashstyle = Const.DefaultIndicatorDashStyle;
42 | private Color _plot1color = Const.DefaultIndicatorColor_GreyedOut;
43 | private int _plot1width = Const.DefaultLineWidth;
44 | private DashStyle _plot1dashstyle = Const.DefaultIndicatorDashStyle;
45 |
46 | #endregion
47 |
48 | protected override void OnInit()
49 | {
50 | IsEntry = true;
51 | IsStop = false;
52 | IsTarget = false;
53 | Add(new OutputDescriptor(new Pen(this.Plot0Color, this.Plot0Width), OutputSerieDrawStyle.Line, "Occurred"));
54 | Add(new OutputDescriptor(new Pen(this.Plot0Color, this.Plot1Width), OutputSerieDrawStyle.Line, "Entry"));
55 |
56 | IsOverlay = false;
57 | CalculateOnClosedBar = true;
58 |
59 | this.RequiredBarsCount = 20;
60 | }
61 |
62 | protected override void OnCalculate()
63 | {
64 | Occurred.Set(LeadIndicator.Lonely_Warrior_Indicator()[0]);
65 |
66 | PlotColors[0][0] = this.Plot0Color;
67 | OutputDescriptors[0].PenStyle = this.Dash0Style;
68 | OutputDescriptors[0].Pen.Width = this.Plot0Width;
69 |
70 | PlotColors[1][0] = this.Plot1Color;
71 | OutputDescriptors[1].PenStyle = this.Dash1Style;
72 | OutputDescriptors[1].Pen.Width = this.Plot1Width;
73 | }
74 |
75 |
76 | public override string ToString()
77 | {
78 | return "Lonely Warrior (C)";
79 | }
80 |
81 | public override string DisplayName
82 | {
83 | get
84 | {
85 | return "Lonely Warrior (C)";
86 | }
87 | }
88 |
89 | #region Properties
90 |
91 | [Browsable(false)]
92 | [XmlIgnore()]
93 | public DataSeries Occurred
94 | {
95 | get { return Outputs[0]; }
96 | }
97 |
98 | [Browsable(false)]
99 | [XmlIgnore()]
100 | public DataSeries Entry
101 | {
102 | get { return Outputs[1]; }
103 | }
104 |
105 | public override IList GetEntries()
106 | {
107 | return new[]{Entry};
108 | }
109 |
110 | ///
111 | ///
112 | [Description("Select Color for the indicator.")]
113 | [Category("Plots")]
114 | [DisplayName("Color")]
115 | public Color Plot0Color
116 | {
117 | get { return _plot0color; }
118 | set { _plot0color = value; }
119 | }
120 | // Serialize Color object
121 | [Browsable(false)]
122 | public string Plot0ColorSerialize
123 | {
124 | get { return SerializableColor.ToString(_plot0color); }
125 | set { _plot0color = SerializableColor.FromString(value); }
126 | }
127 |
128 | ///
129 | ///
130 | [Description("Line width for indicator.")]
131 | [Category("Plots")]
132 | [DisplayName("Line width")]
133 | public int Plot0Width
134 | {
135 | get { return _plot0width; }
136 | set { _plot0width = Math.Max(1, value); }
137 | }
138 |
139 | ///
140 | ///
141 | [Description("DashStyle for indicator.")]
142 | [Category("Plots")]
143 | [DisplayName("DashStyle")]
144 | public DashStyle Dash0Style
145 | {
146 | get { return _plot0dashstyle; }
147 | set { _plot0dashstyle = value; }
148 | }
149 |
150 | ///
151 | ///
152 | [Description("Select color for the indicator.")]
153 | [Category("Plots")]
154 | [DisplayName("Color")]
155 | public Color Plot1Color
156 | {
157 | get { return _plot1color; }
158 | set { _plot1color = value; }
159 | }
160 | // Serialize Color object
161 | [Browsable(false)]
162 | public string Plot1ColorSerialize
163 | {
164 | get { return SerializableColor.ToString(_plot1color); }
165 | set { _plot1color = SerializableColor.FromString(value); }
166 | }
167 |
168 | ///
169 | ///
170 | [Description("Line width for indicator.")]
171 | [Category("Plots")]
172 | [DisplayName("Line width")]
173 | public int Plot1Width
174 | {
175 | get { return _plot1width; }
176 | set { _plot1width = Math.Max(1, value); }
177 | }
178 |
179 | ///
180 | ///
181 | [Description("DashStyle for indicator.")]
182 | [Category("Plots")]
183 | [DisplayName("DashStyle")]
184 | public DashStyle Dash1Style
185 | {
186 | get { return _plot1dashstyle; }
187 | set { _plot1dashstyle = value; }
188 | }
189 |
190 | #endregion
191 | }
192 | }
--------------------------------------------------------------------------------
/Condition/PopGun_Condition.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.ComponentModel;
4 | using System.Drawing;
5 | using System.Drawing.Drawing2D;
6 | using System.Linq;
7 | using System.Xml;
8 | using System.Xml.Serialization;
9 | using AgenaTrader.API;
10 | using AgenaTrader.Custom;
11 | using AgenaTrader.Plugins;
12 | using AgenaTrader.Helper;
13 |
14 | ///
15 | /// Version: in progress
16 | /// -------------------------------------------------------------------------
17 | /// Christian Kovar 2016
18 | /// Simon Pucher 2016
19 | /// -------------------------------------------------------------------------
20 | /// todo description
21 | /// -------------------------------------------------------------------------
22 | /// ****** Important ******
23 | /// To compile this script without any error you also need access to the utility indicator to use global source code elements.
24 | /// You will find this script on GitHub: https://raw.githubusercontent.com/simonpucher/AgenaTrader/master/Utilities/GlobalUtilities_Utility.cs
25 | /// -------------------------------------------------------------------------
26 | /// Namespace holds all indicators and is required. Do not change it.
27 | ///
28 | namespace AgenaTrader.UserCode
29 | {
30 | [Category("Script-Trading")]
31 | [Description("Condition für Pop Gun Bar Pattern")]
32 | [IsEntryAttribute(true)]
33 | [IsStopAttribute(false)]
34 | [IsTargetAttribute(false)]
35 | [OverrulePreviousStopPrice(false)]
36 | public class PopGun_Condition : UserScriptedCondition
37 | {
38 | #region Variables
39 | //input
40 | private int _PopGunExpires = 5;
41 | private bool _issnapshotactive = false;
42 | private bool _isevaluationactive = false;
43 | private bool _filter_NoShortRSI = false;
44 | private bool _filter_NoLongRSI = false;
45 | private bool _filter_NoTriggerEOD = false;
46 | private PopGunType _PopGunType = PopGunType.ThreeBarReversal;
47 |
48 | //internal
49 | private PopGun_Indicator _popgun_indicator = null;
50 |
51 | #endregion
52 |
53 |
54 |
55 | protected override void OnInit()
56 | {
57 | IsEntry = true;
58 | IsStop = false;
59 | IsTarget = false;
60 | Add(new OutputDescriptor(Color.FromKnownColor(KnownColor.Black), "Occurred"));
61 | Add(new OutputDescriptor(Color.FromArgb(255, 92, 242, 57), "Entry"));
62 | IsOverlay = false;
63 | CalculateOnClosedBar = true;
64 | RequiredBarsCount = 3;
65 | }
66 |
67 | protected override void OnBarsRequirements()
68 | {
69 | base.OnBarsRequirements();
70 |
71 | }
72 |
73 | protected override void OnStart()
74 | {
75 | base.OnStart();
76 |
77 | //Init our indicator to get code access
78 | this._popgun_indicator = new PopGun_Indicator();
79 | this._popgun_indicator.SetData(this.PopGunExpires, this.IsSnapshotActive, this.IsEvaluationActive, this.Filter_NoTriggerEOD);
80 | }
81 |
82 | protected override void OnCalculate()
83 | {
84 | if (this.Bars != null && this.Bars.Count > 0 && ProcessingBarIndex > 3)
85 | {
86 | //ShowGap Indikator aufrufen. Dieser liefert 100 für Long Einstieg und -100 für Short Einstieg. Liefert 0 für kein Einstiegssignal
87 | double PopGun_Indicator_Value = this._popgun_indicator.calculate(this.Bars, this.ProcessingBarIndex, this.PopGunType);
88 | if (PopGun_Indicator_Value == 100)
89 | {
90 | Occurred.Set(1);
91 | Entry.Set(GetCurrentBid());
92 | }
93 | else if (PopGun_Indicator_Value == -100)
94 | {
95 | Occurred.Set(-1);
96 | Entry.Set(GetCurrentBid());
97 | }
98 |
99 | else
100 | {
101 | Occurred.Set(0);
102 | Entry.Set(GetCurrentBid());
103 | }
104 | }
105 | }
106 |
107 | #region Properties
108 |
109 |
110 | [Browsable(false)]
111 | [XmlIgnore()]
112 | public DataSeries Occurred
113 | {
114 | get { return Outputs[0]; }
115 | }
116 |
117 | [Browsable(false)]
118 | [XmlIgnore()]
119 | public DataSeries Entry
120 | {
121 | get { return Outputs[1]; }
122 | }
123 |
124 | public override IList GetEntries()
125 | {
126 | return new[]{Entry};
127 | }
128 |
129 | [Description("Type of PopGun Pattern you would like to use.")]
130 | [InputParameter]
131 | [DisplayName("Pop Gun Type")]
132 | public PopGunType PopGunType
133 | {
134 | get { return _PopGunType; }
135 | set { _PopGunType = value; }
136 | }
137 |
138 |
139 | [Description("Wieviel Bars ist PopGunTrigger gültig?")]
140 | [InputParameter]
141 | [DisplayName("PopGunExpires")]
142 | public int PopGunExpires
143 | {
144 | get { return _PopGunExpires; }
145 | set { _PopGunExpires = value; }
146 | }
147 |
148 | [Description("Creates snapshots on signals")]
149 | [InputParameter]
150 | [DisplayName("Snapshot is active")]
151 | public bool IsSnapshotActive
152 | {
153 | get { return _issnapshotactive; }
154 | set { _issnapshotactive = value; }
155 | }
156 |
157 | [Description("Creates evalation (P/L) on signals")]
158 | [InputParameter]
159 | [DisplayName("Evalation is active")]
160 | public bool IsEvaluationActive
161 | {
162 | get { return _isevaluationactive; }
163 | set { _isevaluationactive = value; }
164 | }
165 |
166 | [Description("No Long Trades when RSI > 70")]
167 | [Category("TradeFilter")]
168 | [DisplayName("No Long Trades when RSI > 70")]
169 | public bool Filter_NoLongRSI
170 | {
171 | get { return _filter_NoLongRSI; }
172 | set { _filter_NoLongRSI = value; }
173 | }
174 |
175 | [Description("No Short Trades when RSI < 30")]
176 | [Category("TradeFilter")]
177 | [DisplayName("No Short Trades when RSI < 30")]
178 | public bool Filter_NoShortRSI
179 | {
180 | get { return _filter_NoShortRSI; }
181 | set { _filter_NoShortRSI = value; }
182 | }
183 |
184 | [Description("No PopGun is triggered, if the expire date is targeted for the following day")]
185 | [Category("TradeFilter")]
186 | [DisplayName("No Trigger before EOD")]
187 | public bool Filter_NoTriggerEOD
188 | {
189 | get { return _filter_NoTriggerEOD; }
190 | set { _filter_NoTriggerEOD = value; }
191 | }
192 |
193 | #endregion
194 | }
195 | }
--------------------------------------------------------------------------------
/Strategy/DeepCorrectionTrend_Strategy.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.ComponentModel;
4 | using System.Drawing;
5 | using System.Drawing.Drawing2D;
6 | using System.Linq;
7 | using System.Xml;
8 | using System.Xml.Serialization;
9 | using AgenaTrader.API;
10 | using AgenaTrader.Custom;
11 | using AgenaTrader.Plugins;
12 | using AgenaTrader.Helper;
13 |
14 | ///
15 | /// Version: in progress
16 | /// -------------------------------------------------------------------------
17 | /// Christian Kovar 2016
18 | /// -------------------------------------------------------------------------
19 | /// todo
20 | /// -------------------------------------------------------------------------
21 | /// ****** Important ******
22 | /// To compile this script without any error you also need access to the utility indicator to use these global source code elements.
23 | /// You will find this indicator on GitHub: https://raw.githubusercontent.com/simonpucher/AgenaTrader/master/Utilities/GlobalUtilities_Utility.cs
24 | /// -------------------------------------------------------------------------
25 | /// Namespace holds all indicators and is required. Do not change it.
26 | ///
27 | namespace AgenaTrader.UserCode
28 | {
29 | [Description("Strategy which trades deep correction of ongoing trend")]
30 | public class DeepCorrectionTrend_Strategy : UserStrategy
31 | {
32 | #region Variables
33 | //constants
34 | const double MarketPhaseDeepCorrectionLong = 5.3d;
35 | const double MarketPhaseDeepCorrectionShort = -5.3d;
36 |
37 | //input
38 | private int _trendSize = 1;
39 |
40 | //internal
41 | private IOrder _orderenterlong;
42 | private IOrder _orderentershort;
43 | private DeepCorrectionTrend_Indikator _DeepCorrectionTrend_Indikator;
44 | bool FirstOnBarUpdate = false;
45 | bool FirstCalculate = false;
46 |
47 | #endregion
48 |
49 | protected override void OnInit()
50 | {
51 | CalculateOnClosedBar = true;
52 | RequiredBarsCount = 5;
53 | _DeepCorrectionTrend_Indikator = new DeepCorrectionTrend_Indikator();
54 | }
55 |
56 | protected override void OnOrderExecution(IExecution execution)
57 | {
58 | if (execution.PositionType == PositionType.Flat)
59 | {
60 | _orderentershort = null;
61 | _orderenterlong = null;
62 | }
63 | }
64 |
65 |
66 | protected override void OnCalculate()
67 | {
68 | //for debugging reason only, just to get a hook in
69 | if (ProcessingBarIndex + 1 == 157)
70 | {
71 | int a = 1 + 1;
72 | }
73 |
74 | if (FirstOnBarUpdate == false)
75 | {
76 | Print("FirstOnBarUpdate " + Bars[0].Time + " Strat");
77 | FirstOnBarUpdate = true;
78 | }
79 |
80 |
81 | //Lets call the calculate method and save the result with the trade action
82 | ResultValue_DeepCorrection ResultValue = this._DeepCorrectionTrend_Indikator.calculate(Close, TrendSize, Bars[0], "Strat");
83 |
84 | //Entry
85 | if (ResultValue.Entry.HasValue)
86 | {
87 | switch (ResultValue.Entry)
88 | {
89 | case OrderDirection.Buy:
90 | this.DoEnterLong(ResultValue.StopLoss, ResultValue.Target);
91 | break;
92 | case OrderDirection.Sell:
93 | // this.DoEnterShort(ResultValue.StopLoss, ResultValue.Target);
94 | break;
95 | }
96 | }
97 | }
98 |
99 | ///
100 | /// Create Long Order and Stop.
101 | ///
102 | private void DoEnterLong(double StopLoss, double Target)
103 | {
104 | if (_orderenterlong == null)
105 | {
106 | Print("Strategie" + Bars[0].Time + " Long " + "Close: " + Bars[0].Close + " StopLoss: " + StopLoss + " Target: " + Target);
107 | _orderenterlong = SubmitOrder(new StrategyOrderParameters {Direction = OrderDirection.Buy, Type = OrderType.Market, Quantity = 10,
108 | Mode = OrderMode.Direct,
109 | //Mode = this.GetType().Name + " " + PositionType.Long + "_" + this.Instrument.Symbol + "_" + Bars[0].Timestamp.Ticks.ToString(),
110 | Instrument = this.Instrument, TimeFrame = this.TimeFrame});
111 | SetUpStopLoss(_orderenterlong.Name, CalculationMode.Price, StopLoss, false);
112 | SetUpProfitTarget(_orderenterlong.Name, CalculationMode.Price, Target);
113 | }
114 | }
115 |
116 | ///
117 | /// Create Short Order and Stop.
118 | ///
119 | private void DoEnterShort(double StopLoss, double Target)
120 | {
121 | if (_orderentershort == null)
122 | {
123 | Print("Short" + "Close: " + Bars[0].Close + "StopLoss: " + StopLoss + " Target: " + Target);
124 | _orderentershort = SubmitOrder(new StrategyOrderParameters {Direction = OrderDirection.Sell, Type = OrderType.Market, Quantity = GlobalUtilities.AdjustPositionToRiskManagement(this.Root.Core.AccountManager, this.Root.Core.PreferenceManager, this.Instrument, Bars[0].Close), SignalName = this.GetType().Name + " " + PositionType.Short + "_" + this.Instrument.Symbol + "_" + Bars[0].Time.Ticks.ToString(), Instrument = this.Instrument, TimeFrame = this.TimeFrame});
125 | ////SetUpStopLoss(_orderentershort.Name, CalculationMode.Price, StopLoss, false);
126 | ////SetUpProfitTarget(_orderentershort.Name, CalculationMode.Price, Target);
127 | SetUpStopLoss(_orderenterlong.Name, CalculationMode.Price, Bars[0].Close * 1.05, false);
128 | SetUpProfitTarget(_orderenterlong.Name, CalculationMode.Price, Bars[0].Close / 1.11);
129 | }
130 | }
131 |
132 |
133 | public override string ToString()
134 | {
135 | return "Deep Correction Trend (S)";
136 | }
137 |
138 | public override string DisplayName
139 | {
140 | get
141 | {
142 | return "Deep Correction Trend (S)";
143 | }
144 | }
145 |
146 |
147 |
148 | #region Properties
149 |
150 | [Description("Trendsize (0-3)")]
151 | [InputParameter]
152 | public int TrendSize
153 | {
154 | get { return _trendSize; }
155 | set { _trendSize = Math.Max(1, value); }
156 | }
157 |
158 | #endregion
159 | }
160 | }
161 |
--------------------------------------------------------------------------------
/Indicator/King_Pinball_Indicator.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.ComponentModel;
4 | using System.Drawing;
5 | using System.Drawing.Drawing2D;
6 | using System.Linq;
7 | using System.Xml;
8 | using System.Xml.Serialization;
9 | using AgenaTrader.API;
10 | using AgenaTrader.Custom;
11 | using AgenaTrader.Plugins;
12 | using AgenaTrader.Helper;
13 |
14 | ///
15 | /// Version: 1.1.0
16 | /// -------------------------------------------------------------------------
17 | /// Simon Pucher 2017
18 | /// -------------------------------------------------------------------------
19 | /// King Pinball by Traderfox: https://youtu.be/bwFGeUVmF5o
20 | /// -------------------------------------------------------------------------
21 | /// ****** Important ******
22 | /// To compile this script without any error you also need access to the utility indicator to use global source code elements.
23 | /// You will find this script on GitHub: https://raw.githubusercontent.com/simonpucher/AgenaTrader/master/Utilities/GlobalUtilities_Utility.cs
24 | /// -------------------------------------------------------------------------
25 | /// Namespace holds all indicators and is required. Do not change it.
26 | ///
27 | namespace AgenaTrader.UserCode
28 | {
29 | [Description("King Pinball")]
30 | public class King_Pinball_Indicator : UserIndicator
31 | {
32 |
33 | bool shortsignalbb = false;
34 | bool longsignalbb = false;
35 |
36 | private int _bollinger_period = 20;
37 | private double _bollinger_stddev = 2;
38 |
39 | private int _macd_fast = 12;
40 | private int _macd_slow = 26;
41 | private int _macd_smooth = 9;
42 |
43 | private Color _color_long_signal = Const.DefaultArrowLongColor;
44 | private Color _color_short_signal = Const.DefaultArrowShortColor;
45 |
46 | protected override void OnInit()
47 | {
48 | AddOutput(new OutputDescriptor(Color.FromKnownColor(KnownColor.Orange), "Plot_Signal_King_Pinball"));
49 | CalculateOnClosedBar = true;
50 | }
51 |
52 | protected override void OnCalculate()
53 | {
54 | Bollinger bol = Bollinger(this.Bollinger_stddev, this.Bollinger_Period);
55 | if (Close[0] < bol.Lower[0])
56 | {
57 | longsignalbb = true;
58 | }
59 | else if (Close[0] > bol.Upper[0])
60 | {
61 | shortsignalbb = true;
62 | }
63 | else
64 | {
65 | //nothing
66 | }
67 |
68 | MACD macd = MACD(this.MACD_Fast, this.MACD_Slow, this.MACD_Smooth);
69 | if (longsignalbb && CrossAbove(macd.Default, macd.Avg, 0))
70 | {
71 | AddChartArrowUp(Time[0].ToString()+"long", 0, Low[0], this.ColorLongSignal);
72 | MyPlot1.Set(1);
73 | longsignalbb = false;
74 | }
75 | else if (shortsignalbb && CrossBelow(macd.Default, macd.Avg, 0))
76 | {
77 | AddChartArrowDown(Time[0].ToString()+"short", 0, High[0], this.ColorShortSignal);
78 | MyPlot1.Set(-1);
79 | shortsignalbb = false;
80 | }
81 | else
82 | {
83 | MyPlot1.Set(0);
84 | }
85 |
86 |
87 | }
88 |
89 | #region Properties
90 |
91 | [Browsable(false)]
92 | [XmlIgnore()]
93 | public DataSeries MyPlot1
94 | {
95 | get { return Outputs[0]; }
96 | }
97 |
98 |
99 |
100 | ///
101 | ///
102 | [Description("Bollinger Band period.")]
103 | [InputParameter]
104 | [DisplayName("BB period")]
105 | public int Bollinger_Period
106 | {
107 | get { return _bollinger_period; }
108 | set
109 | {
110 | _bollinger_period = value;
111 | }
112 | }
113 |
114 | ///
115 | ///
116 | [Description("Bollinger Band standard deviation")]
117 | [InputParameter]
118 | [DisplayName("BB stddev")]
119 | public double Bollinger_stddev
120 | {
121 | get { return _bollinger_stddev; }
122 | set
123 | {
124 | _bollinger_stddev = value;
125 | }
126 | }
127 |
128 | ///
129 | ///
130 | [Description("Bollinger Band fast")]
131 | [InputParameter]
132 | [DisplayName("MACD fast")]
133 | public int MACD_Fast
134 | {
135 | get { return _macd_fast; }
136 | set
137 | {
138 | _macd_fast = value;
139 | }
140 | }
141 |
142 | ///
143 | ///
144 | [Description("Bollinger Band slow")]
145 | [InputParameter]
146 | [DisplayName("MACD slow")]
147 | public int MACD_Slow
148 | {
149 | get { return _macd_slow; }
150 | set
151 | {
152 | _macd_slow = value;
153 | }
154 | }
155 |
156 | ///
157 | ///
158 | [Description("Bollinger Band smooth")]
159 | [InputParameter]
160 | [DisplayName("MACD smooth")]
161 | public int MACD_Smooth
162 | {
163 | get { return _macd_smooth; }
164 | set
165 | {
166 | _macd_smooth = value;
167 | }
168 | }
169 |
170 | ///
171 | ///
172 | [Description("Select Color for the long signal.")]
173 | [Category("Color")]
174 | [DisplayName("Signal Long")]
175 | public Color ColorLongSignal
176 | {
177 | get { return _color_long_signal; }
178 | set { _color_long_signal = value; }
179 | }
180 |
181 |
182 | // Serialize Color object
183 | [Browsable(false)]
184 | public string ColorLongSignalSerialize
185 | {
186 | get { return SerializableColor.ToString(_color_long_signal); }
187 | set { _color_long_signal = SerializableColor.FromString(value); }
188 | }
189 |
190 | ///
191 | ///
192 | [Description("Select Color for the long signal.")]
193 | [Category("Color")]
194 | [DisplayName("Signal Long")]
195 | public Color ColorShortSignal
196 | {
197 | get { return _color_short_signal; }
198 | set { _color_short_signal = value; }
199 | }
200 |
201 |
202 | // Serialize Color object
203 | [Browsable(false)]
204 | public string ColorShortSignalSerialize
205 | {
206 | get { return SerializableColor.ToString(_color_short_signal); }
207 | set { _color_short_signal = SerializableColor.FromString(value); }
208 | }
209 |
210 | #endregion
211 | }
212 | }
--------------------------------------------------------------------------------
/Indicator/Choppy_Market_Index_Indicator.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.ComponentModel;
4 | using System.Drawing;
5 | using System.Drawing.Drawing2D;
6 | using System.Linq;
7 | using System.Xml;
8 | using System.Xml.Serialization;
9 | using AgenaTrader.API;
10 | using AgenaTrader.Custom;
11 | using AgenaTrader.Plugins;
12 | using AgenaTrader.Helper;
13 |
14 | ///
15 | /// Version: 1.0.0
16 | /// -------------------------------------------------------------------------
17 | /// Simon Pucher 2018
18 | /// -------------------------------------------------------------------------
19 | /// https://github.com/simonpucher/AgenaTrader/issues/52
20 | /// -------------------------------------------------------------------------
21 | /// ****** Important ******
22 | /// To compile this script without any error you also need access to the utility indicator to use global source code elements.
23 | /// You will find this script on GitHub: https://raw.githubusercontent.com/simonpucher/AgenaTrader/master/Utilities/GlobalUtilities_Utility.cs
24 | /// -------------------------------------------------------------------------
25 | /// Namespace holds all indicators and is required. Do not change it.
26 | ///
27 | namespace AgenaTrader.UserCode
28 | {
29 | [Description("Choppy Market Index")]
30 | public class Choppy_Market_Index_Indicator : UserIndicator
31 | {
32 |
33 | bool shortsignalbb = false;
34 | bool longsignalbb = false;
35 |
36 | private int _bollinger_period = 20;
37 | private double _bollinger_stddev = 2;
38 |
39 | private int _macd_fast = 12;
40 | private int _macd_slow = 26;
41 | private int _macd_smooth = 9;
42 |
43 | private Color _color_long_signal = Const.DefaultArrowLongColor;
44 | private Color _color_short_signal = Const.DefaultArrowShortColor;
45 |
46 | protected override void OnInit()
47 | {
48 | AddOutput(new OutputDescriptor(Color.FromKnownColor(KnownColor.Orange), "Plot_Signal_King_Pinball"));
49 | CalculateOnClosedBar = true;
50 | }
51 |
52 | protected override void OnCalculate()
53 | {
54 | Bollinger bol = Bollinger(this.Bollinger_stddev, this.Bollinger_Period);
55 | if (Close[0] < bol.Lower[0])
56 | {
57 | longsignalbb = true;
58 | }
59 | else if (Close[0] > bol.Upper[0])
60 | {
61 | shortsignalbb = true;
62 | }
63 | else
64 | {
65 | //nothing
66 | }
67 |
68 | MACD macd = MACD(this.MACD_Fast, this.MACD_Slow, this.MACD_Smooth);
69 | if (longsignalbb && CrossAbove(macd.Default, macd.Avg, 0))
70 | {
71 | AddChartArrowUp(Time[0].ToString()+"long", 0, Low[0], this.ColorLongSignal);
72 | MyPlot1.Set(1);
73 | longsignalbb = false;
74 | }
75 | else if (shortsignalbb && CrossBelow(macd.Default, macd.Avg, 0))
76 | {
77 | AddChartArrowDown(Time[0].ToString()+"short", 0, High[0], this.ColorShortSignal);
78 | MyPlot1.Set(-1);
79 | shortsignalbb = false;
80 | }
81 | else
82 | {
83 | MyPlot1.Set(0);
84 | }
85 |
86 |
87 | }
88 |
89 | #region Properties
90 |
91 | [Browsable(false)]
92 | [XmlIgnore()]
93 | public DataSeries MyPlot1
94 | {
95 | get { return Outputs[0]; }
96 | }
97 |
98 |
99 |
100 | ///
101 | ///
102 | [Description("Bollinger Band period.")]
103 | [InputParameter]
104 | [DisplayName("BB period")]
105 | public int Bollinger_Period
106 | {
107 | get { return _bollinger_period; }
108 | set
109 | {
110 | _bollinger_period = value;
111 | }
112 | }
113 |
114 | ///
115 | ///
116 | [Description("Bollinger Band standard deviation")]
117 | [InputParameter]
118 | [DisplayName("BB stddev")]
119 | public double Bollinger_stddev
120 | {
121 | get { return _bollinger_stddev; }
122 | set
123 | {
124 | _bollinger_stddev = value;
125 | }
126 | }
127 |
128 | ///
129 | ///
130 | [Description("Bollinger Band fast")]
131 | [InputParameter]
132 | [DisplayName("MACD fast")]
133 | public int MACD_Fast
134 | {
135 | get { return _macd_fast; }
136 | set
137 | {
138 | _macd_fast = value;
139 | }
140 | }
141 |
142 | ///
143 | ///
144 | [Description("Bollinger Band slow")]
145 | [InputParameter]
146 | [DisplayName("MACD slow")]
147 | public int MACD_Slow
148 | {
149 | get { return _macd_slow; }
150 | set
151 | {
152 | _macd_slow = value;
153 | }
154 | }
155 |
156 | ///
157 | ///
158 | [Description("Bollinger Band smooth")]
159 | [InputParameter]
160 | [DisplayName("MACD smooth")]
161 | public int MACD_Smooth
162 | {
163 | get { return _macd_smooth; }
164 | set
165 | {
166 | _macd_smooth = value;
167 | }
168 | }
169 |
170 | ///
171 | ///
172 | [Description("Select Color for the long signal.")]
173 | [Category("Color")]
174 | [DisplayName("Signal Long")]
175 | public Color ColorLongSignal
176 | {
177 | get { return _color_long_signal; }
178 | set { _color_long_signal = value; }
179 | }
180 |
181 |
182 | // Serialize Color object
183 | [Browsable(false)]
184 | public string ColorLongSignalSerialize
185 | {
186 | get { return SerializableColor.ToString(_color_long_signal); }
187 | set { _color_long_signal = SerializableColor.FromString(value); }
188 | }
189 |
190 | ///
191 | ///
192 | [Description("Select Color for the long signal.")]
193 | [Category("Color")]
194 | [DisplayName("Signal Long")]
195 | public Color ColorShortSignal
196 | {
197 | get { return _color_short_signal; }
198 | set { _color_short_signal = value; }
199 | }
200 |
201 |
202 | // Serialize Color object
203 | [Browsable(false)]
204 | public string ColorShortSignalSerialize
205 | {
206 | get { return SerializableColor.ToString(_color_short_signal); }
207 | set { _color_short_signal = SerializableColor.FromString(value); }
208 | }
209 |
210 | #endregion
211 | }
212 | }
--------------------------------------------------------------------------------
/Indicator/Distance_Indicator.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.ComponentModel;
4 | using System.Drawing;
5 | using System.Drawing.Drawing2D;
6 | using System.Linq;
7 | using System.Xml;
8 | using System.Xml.Serialization;
9 | using AgenaTrader.API;
10 | using AgenaTrader.Custom;
11 | using AgenaTrader.Plugins;
12 | using AgenaTrader.Helper;
13 |
14 | ///
15 | /// Version: 1.3.0
16 | /// -------------------------------------------------------------------------
17 | /// Simon Pucher 2016
18 | /// -------------------------------------------------------------------------
19 | /// ****** Important ******
20 | /// To compile this indicator without any error you also need access to the utility indicator to use these global source code elements.
21 | /// You will find this indicator on GitHub: https://raw.githubusercontent.com/simonpucher/AgenaTrader/master/Utilities/GlobalUtilities_Utility.cs
22 | /// -------------------------------------------------------------------------
23 | /// Namespace holds all indicators and is required. Do not change it.
24 | ///
25 | namespace AgenaTrader.UserCode
26 | {
27 | ///
28 | /// Selectable MAs for this indicator.
29 | ///
30 | public enum Enum_Distance_Indicator_MA
31 | {
32 | SMA = 0,
33 | EMA = 1
34 | }
35 |
36 | ///
37 | /// Selectable the type of signal for this indicator.
38 | ///
39 | public enum Enum_Type_of_Signal
40 | {
41 | ShowPercent = 0,
42 | ShowDiscreteSignal = 1
43 | }
44 |
45 | [Description("Distance in percent to a mean average indicator.")]
46 | public class Distance_Indicator : UserIndicator
47 | {
48 | private int _Period = 200;
49 | private Enum_Distance_Indicator_MA _MA_1_Selected = Enum_Distance_Indicator_MA.SMA;
50 | private Enum_Type_of_Signal _TypeOfSignal = Enum_Type_of_Signal.ShowPercent;
51 | private double _PercentThreshold = 3.0;
52 |
53 | protected override void OnInit()
54 | {
55 | Add(new OutputDescriptor(Color.FromKnownColor(KnownColor.Orange), "MyPlot1"));
56 | //Add(new OutputDescriptor(Color.FromKnownColor(KnownColor.Gray), "MyPlot2"));
57 | IsOverlay = false;
58 | CalculateOnClosedBar = true;
59 | }
60 |
61 | protected override void OnCalculate()
62 | {
63 | if (this.TypeOfSignal == Enum_Type_of_Signal.ShowPercent)
64 | {
65 | switch (this.MA_1_Selected)
66 | {
67 | case Enum_Distance_Indicator_MA.SMA:
68 | SMA _sma = SMA(this.Period);
69 | double result_s = (InSeries[0] / (_sma[0] / 100)) - 100;
70 | MyPlot1.Set(result_s);
71 | //MyPlot2.Set(0);
72 | break;
73 | case Enum_Distance_Indicator_MA.EMA:
74 | EMA _ema = EMA(this.Period);
75 | double result_e = (InSeries[0] / (_ema[0] / 100)) - 100;
76 | MyPlot1.Set(result_e);
77 | //MyPlot2.Set(0);
78 | break;
79 | default:
80 | break;
81 | }
82 | }
83 | else if (this.TypeOfSignal == Enum_Type_of_Signal.ShowDiscreteSignal)
84 | {
85 | switch (this.MA_1_Selected)
86 | {
87 | case Enum_Distance_Indicator_MA.SMA:
88 | SMA _sma = SMA(this.Period);
89 | double result_s = (InSeries[0] / (_sma[0] / 100)) - 100;
90 | if (result_s < this.PercentThreshold && result_s >= 0)
91 | {
92 | MyPlot1.Set(1);
93 | }
94 | else if (result_s > (this.PercentThreshold * (-1)) && result_s < 0)
95 | {
96 | MyPlot1.Set(-1);
97 | }
98 | else
99 | {
100 | MyPlot1.Set(0);
101 | }
102 | //MyPlot2.Set(0);
103 | break;
104 | case Enum_Distance_Indicator_MA.EMA:
105 | EMA _ema = EMA(this.Period);
106 | double result_e = (InSeries[0] / (_ema[0] / 100)) - 100;
107 | if (result_e < this.PercentThreshold && result_e >= 0)
108 | {
109 | MyPlot1.Set(1);
110 | }
111 | else if (result_e > (this.PercentThreshold * (-1)) && result_e < 0)
112 | {
113 | MyPlot1.Set(-1);
114 | }
115 | else
116 | {
117 | MyPlot1.Set(0);
118 | }
119 | //MyPlot2.Set(0);
120 | break;
121 | default:
122 | break;
123 | }
124 | }
125 |
126 | }
127 |
128 | #region Properties
129 |
130 | [Browsable(false)]
131 | [XmlIgnore()]
132 | public DataSeries MyPlot1
133 | {
134 | get { return Outputs[0]; }
135 | }
136 |
137 | //[Browsable(false)]
138 | //[XmlIgnore()]
139 | //public DataSeries MyPlot2
140 | //{
141 | // get { return Outputs[1]; }
142 | //}
143 |
144 |
145 | [Description("Period of the mean average.")]
146 | [InputParameter]
147 | [DisplayName("Period")]
148 | public int Period
149 | {
150 | get { return _Period; }
151 | set { _Period = value; }
152 | }
153 |
154 | ///
155 | ///
156 | [Description("Select the type of MA you would like to use")]
157 | [InputParameter]
158 | [DisplayName("Type of MA")]
159 | public Enum_Distance_Indicator_MA MA_1_Selected
160 | {
161 | get { return _MA_1_Selected; }
162 | set
163 | {
164 | _MA_1_Selected = value;
165 | }
166 | }
167 |
168 |
169 | [Description("Period of the mean average.")]
170 | [InputParameter]
171 | [DisplayName("Period")]
172 | public Enum_Type_of_Signal TypeOfSignal
173 | {
174 | get { return _TypeOfSignal; }
175 | set { _TypeOfSignal = value; }
176 | }
177 |
178 | [Description("Threshold in percent to show a discreet signal.")]
179 | [InputParameter]
180 | [DisplayName("Percent Threshold")]
181 | public double PercentThreshold
182 | {
183 | get { return _PercentThreshold; }
184 | set { _PercentThreshold = value; }
185 | }
186 |
187 | #endregion
188 | }
189 | }
--------------------------------------------------------------------------------
/Indicator/Performance_Indicator.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.ComponentModel;
4 | using System.Drawing;
5 | using System.Drawing.Drawing2D;
6 | using System.Linq;
7 | using System.Xml;
8 | using System.Xml.Serialization;
9 | using AgenaTrader.API;
10 | using AgenaTrader.Custom;
11 | using AgenaTrader.Plugins;
12 | using AgenaTrader.Helper;
13 |
14 | ///
15 | /// Version: 1.2.0
16 | /// -------------------------------------------------------------------------
17 | /// Simon Pucher 2016
18 | /// -------------------------------------------------------------------------
19 | /// This indicator can be used in the scanner column to display the yearly or daily performance.
20 | /// -------------------------------------------------------------------------
21 | /// ****** Important ******
22 | /// To compile this script without any error you also need access to the utility indicator to use global source code elements.
23 | /// You will find this script on GitHub: https://raw.githubusercontent.com/simonpucher/AgenaTrader/master/Utilities/GlobalUtilities_Utility.cs
24 | /// -------------------------------------------------------------------------
25 | /// Namespace holds all indicators and is required. Do not change it.
26 | ///
27 | namespace AgenaTrader.UserCode
28 | {
29 |
30 | public enum PerformanceCalculationType
31 | {
32 | BarCount = 0,
33 | ThisYear = 1,
34 | SelectedDate = 2
35 | }
36 |
37 | [Description("Show the performance of an instrument in the scanner column. Indicator calculates bars backwards so you need to configure the timeframe correctly.")]
38 | public class Performance_Indicator : UserIndicator
39 | {
40 | //InSeries
41 | private int _barscount = 365;
42 | private DateTime _selecteddate = DateTime.Now.Date;
43 | private int _opacity = Const.DefaultOpacity;
44 | private Color _rangecolor = Color.LightBlue;
45 | private PerformanceCalculationType _PerformanceCalculationType = PerformanceCalculationType.BarCount;
46 |
47 |
48 | protected override void OnInit()
49 | {
50 | Add(new OutputDescriptor(Color.FromKnownColor(KnownColor.Orange), "Plot_Performance_Indicator"));
51 |
52 | //to get the latest data into the bars object
53 | CalculateOnClosedBar = false;
54 | IsOverlay = true;
55 |
56 | //Because of Backtesting reasons if we use the advanced mode we need at least two bars
57 | this.RequiredBarsCount = 400;
58 | }
59 |
60 | protected override void OnCalculate()
61 | {
62 | if (IsProcessingBarIndexLast)
63 | {
64 | //if (!this.Instrument.IsInMarketHours(DateTime.Now))
65 | //{
66 | // Plot_Performance_Indicator.Set(0);
67 | //}
68 | //else
69 | //{
70 |
71 | //}
72 | IBar b = null;
73 |
74 | switch (this.PerformanceCalculationType)
75 | {
76 | case PerformanceCalculationType.BarCount:
77 | b = Bars[this.BarsCount];
78 | break;
79 | case PerformanceCalculationType.ThisYear:
80 | b = Bars.Where(x => x.Time.Year != DateTime.Now.Year).LastOrDefault();
81 | break;
82 | case PerformanceCalculationType.SelectedDate:
83 | b = Bars.GetBar(this.SelectedDate);
84 | break;
85 | }
86 |
87 | if (b != null)
88 | {
89 | Plot_Performance_Indicator.Set(((Close[0] - b.Close) * 100) / b.Close);
90 | }
91 |
92 | if (Chart != null)
93 | {
94 | IEnumerable list = Bars.Where(x => x.Time >= b.Time).Where(x => x.Time <= Time[0]);
95 | AddChartRectangle("ORBRect" + b.Time.Ticks, true, b.Time, list.Where(x => x.Low == list.Min(y => y.Low)).LastOrDefault().Low, Time[0], list.Where(x => x.High == list.Max(y => y.High)).LastOrDefault().High, Color.Aquamarine, Color.Aquamarine, 50);
96 | }
97 |
98 | }
99 | }
100 |
101 |
102 | public override string ToString()
103 | {
104 | return "Performance (I)";
105 | }
106 |
107 | public override string DisplayName
108 | {
109 | get
110 | {
111 | return "Performance (I)";
112 | }
113 | }
114 |
115 |
116 | #region Properties
117 |
118 | [Description("Performance will be calculated x bars backwards. Insert 365 for the performance of the last year. Insert 1 for the perfomance since yesterday.")]
119 | [InputParameter]
120 | [DisplayName("Bars backwards")]
121 | public int BarsCount
122 | {
123 | get { return _barscount; }
124 | set { _barscount = value; }
125 | }
126 |
127 |
128 | [Description("Performance will be calculated from today to a dedicated date. The close of this day is used.")]
129 | [InputParameter]
130 | [DisplayName("Selected date")]
131 | public DateTime SelectedDate
132 | {
133 | get { return _selecteddate; }
134 | set { _selecteddate = value; }
135 | }
136 |
137 | [Description("Choose the type of calculation. BarCount = The calculation will use the bars for the calculation. ThisYear = Calculation will be done for today minus the close of the last bar of last year.")]
138 | [InputParameter]
139 | [DisplayName("Type")]
140 | public PerformanceCalculationType PerformanceCalculationType
141 | {
142 | get { return _PerformanceCalculationType; }
143 | set { _PerformanceCalculationType = value; }
144 | }
145 |
146 | [Browsable(false)]
147 | [XmlIgnore()]
148 | public DataSeries Plot_Performance_Indicator
149 | {
150 | get { return Outputs[0]; }
151 | }
152 |
153 |
154 | ///
155 | ///
156 | [Description("Opacity for Drawing")]
157 | [Category("Colors")]
158 | [DisplayName("Opacity")]
159 | public int Opacity
160 | {
161 | get { return _opacity; }
162 | set
163 | {
164 | if (value >= 1 && value <= 100)
165 | {
166 | _opacity = value;
167 | }
168 | else
169 | {
170 | _opacity = Const.DefaultOpacity;
171 | }
172 | }
173 | }
174 |
175 | ///
176 | ///
177 | [Description("Color of the range between the current date and the dedicated date.")]
178 | [Category("Colors")]
179 | [DisplayName("Range Color")]
180 | public Color Color_ORB
181 | {
182 | get { return _rangecolor; }
183 | set { _rangecolor = value; }
184 | }
185 |
186 | [Browsable(false)]
187 | public string Color_ORBSerialize
188 | {
189 | get { return SerializableColor.ToString(_rangecolor); }
190 | set { _rangecolor = SerializableColor.FromString(value); }
191 | }
192 |
193 |
194 |
195 | #endregion
196 | }
197 | }
--------------------------------------------------------------------------------
/Indicator/HighestHighValue_Indicator.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.ComponentModel;
4 | using System.Drawing;
5 | using System.Drawing.Drawing2D;
6 | using System.Linq;
7 | using System.Xml;
8 | using System.Xml.Serialization;
9 | using AgenaTrader.API;
10 | using AgenaTrader.Custom;
11 | using AgenaTrader.Plugins;
12 | using AgenaTrader.Helper;
13 |
14 | ///
15 | /// Version: 1.3.0
16 | /// -------------------------------------------------------------------------
17 | /// Simon Pucher 2016
18 | /// -------------------------------------------------------------------------
19 | /// ****** Important ******
20 | /// To compile this script without any error you also need access to the utility indicator to use global source code elements.
21 | /// You will find this script on GitHub: https://raw.githubusercontent.com/simonpucher/AgenaTrader/master/Utilities/GlobalUtilities_Utility.cs
22 | /// -------------------------------------------------------------------------
23 | /// Namespace holds all indicators and is required. Do not change it.
24 | ///
25 | namespace AgenaTrader.UserCode
26 | {
27 | public enum IndicatorEnum_HighestHighValue
28 | {
29 | SMA = 1,
30 | EMA = 2
31 | }
32 |
33 | [Description("Compare the current value of an indicator to latest high value of the indicator in a defined period of time.")]
34 | public class HighestHighValue_Indicator : UserIndicator
35 | {
36 | //input
37 | private Color _plot1color = Const.DefaultIndicatorColor;
38 | private int _plot1width = Const.DefaultLineWidth;
39 | private DashStyle _plot1dashstyle = Const.DefaultIndicatorDashStyle;
40 | private int _indicatorEMAPeriod = 200;
41 | private int _indicatorSMAPeriod = 200;
42 | private int _comparisonPeriod = 30;
43 | private IndicatorEnum_HighestHighValue _indicatorenum = IndicatorEnum_HighestHighValue.SMA;
44 |
45 | //output
46 |
47 |
48 | //internal
49 | private DataSeries _DATA_List;
50 |
51 | ///
52 | /// Initalizie the OutputDescriptor.
53 | ///
54 | protected override void OnInit()
55 | {
56 | Add(new OutputDescriptor(new Pen(this.Plot1Color, this.Plot0Width), OutputSerieDrawStyle.Line, "HighestHighValue_Indicator"));
57 |
58 | CalculateOnClosedBar = true;
59 | IsOverlay = false;
60 | }
61 |
62 | ///
63 | /// Init all variables on startup.
64 | ///
65 | protected override void OnStart()
66 | {
67 | this._DATA_List = new DataSeries(this);
68 | }
69 |
70 | ///
71 | /// Recalculate all data on each each bar update.
72 | ///
73 | protected override void OnCalculate()
74 | {
75 | double currentvalue = 0.0;
76 | switch (IndicatorEnum)
77 | {
78 | case IndicatorEnum_HighestHighValue.SMA:
79 | currentvalue = SMA(IndicatorSMAPeriod)[0];
80 | break;
81 | case IndicatorEnum_HighestHighValue.EMA:
82 | currentvalue = EMA(IndicatorEMAPeriod)[0];
83 | break;
84 | default:
85 | break;
86 | }
87 |
88 | double lasthighvalue = _DATA_List.Reverse().Take(this.ComparisonPeriod).Max();
89 |
90 | if (lasthighvalue < currentvalue)
91 | {
92 | MyPlot1.Set(1);
93 | }
94 | else
95 | {
96 | MyPlot1.Set(0);
97 | }
98 |
99 | this._DATA_List.Set(currentvalue);
100 |
101 | //set the color
102 | PlotColors[0][0] = this.Plot1Color;
103 | OutputDescriptors[0].PenStyle = this.Dash0Style;
104 | OutputDescriptors[0].Pen.Width = this.Plot0Width;
105 |
106 | }
107 |
108 |
109 | public override string ToString()
110 | {
111 | return "HHV";
112 | }
113 |
114 | public override string DisplayName
115 | {
116 | get
117 | {
118 | return "HHV";
119 | }
120 | }
121 |
122 |
123 | #region Properties
124 |
125 | #region InSeries
126 |
127 | [Description("Type of the indicator")]
128 | [InputParameter]
129 | [DisplayName("Type of the indicator")]
130 | public IndicatorEnum_HighestHighValue IndicatorEnum
131 | {
132 | get { return _indicatorenum; }
133 | set { _indicatorenum = value; }
134 | }
135 |
136 |
137 | [Description("Period for the SMA")]
138 | [InputParameter]
139 | [DisplayName("Period SMA")]
140 | public int IndicatorSMAPeriod
141 | {
142 | get { return _indicatorSMAPeriod; }
143 | set { _indicatorSMAPeriod = value; }
144 | }
145 |
146 | [Description("Period for the EMA")]
147 | [InputParameter]
148 | [DisplayName("Period EMA")]
149 | public int IndicatorEMAPeriod
150 | {
151 | get { return _indicatorEMAPeriod; }
152 | set { _indicatorEMAPeriod = value; }
153 | }
154 |
155 |
156 |
157 | [Description("Period for comparison")]
158 | [InputParameter]
159 | [DisplayName("Period for comparison")]
160 | public int ComparisonPeriod
161 | {
162 | get { return _comparisonPeriod; }
163 | set { _comparisonPeriod = value; }
164 | }
165 |
166 | #region Plotstyle
167 |
168 | [XmlIgnore()]
169 | [Description("Select Color")]
170 | [InputParameter]
171 | [DisplayName("Pricline")]
172 | public Color Plot1Color
173 | {
174 | get { return _plot1color; }
175 | set { _plot1color = value; }
176 | }
177 | [Browsable(false)]
178 | public string Plot1ColorSerialize
179 | {
180 | get { return SerializableColor.ToString(_plot1color); }
181 | set { _plot1color = SerializableColor.FromString(value); }
182 | }
183 |
184 | ///
185 | ///
186 | [Description("Width for Indicator.")]
187 | [InputParameter]
188 | [DisplayName("Line Width Indicator")]
189 | public int Plot0Width
190 | {
191 | get { return _plot1width; }
192 | set { _plot1width = Math.Max(1, value); }
193 | }
194 |
195 |
196 | ///
197 | ///
198 | [Description("DashStyle for Indicator.")]
199 | [InputParameter]
200 | [DisplayName("Dash Style Indicator")]
201 | public DashStyle Dash0Style
202 | {
203 | get { return _plot1dashstyle; }
204 | set { _plot1dashstyle = value; }
205 | }
206 |
207 | #endregion
208 |
209 | #endregion
210 |
211 |
212 | #region Output
213 |
214 | [Browsable(false)]
215 | [XmlIgnore()]
216 | public DataSeries MyPlot1
217 | {
218 | get { return Outputs[0]; }
219 | }
220 |
221 | #endregion
222 |
223 | #endregion
224 | }
225 | }
--------------------------------------------------------------------------------
/Indicator/FiscalYear_Indicator.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.ComponentModel;
4 | using System.Drawing;
5 | using System.Drawing.Drawing2D;
6 | using System.Linq;
7 | using System.Xml;
8 | using System.Xml.Serialization;
9 | using AgenaTrader.API;
10 | using AgenaTrader.Custom;
11 | using AgenaTrader.Plugins;
12 | using AgenaTrader.Helper;
13 | using System.Runtime.CompilerServices;
14 |
15 |
16 | ///
17 | /// Version: 1.1.2
18 | /// -------------------------------------------------------------------------
19 | /// Simon Pucher 2018
20 | /// -------------------------------------------------------------------------
21 | /// ****** Important ******
22 | /// To compile this script without any error you also need access to the utility indicator to use these global source code elements.
23 | /// You will find this indicator on GitHub: https://raw.githubusercontent.com/simonpucher/AgenaTrader/master/Utilities/GlobalUtilities_Utility.cs
24 | /// -------------------------------------------------------------------------
25 | /// Namespace holds all indicators and is required. Do not change it.
26 | ///
27 | namespace AgenaTrader.UserCode
28 | {
29 |
30 |
31 | [Description("Show seasonal trends")]
32 | public class FiscalYear_Indicator : UserIndicator
33 | {
34 |
35 | #region Variables
36 |
37 | private int _vertical_line_width = 1;
38 | private Color _color_vertical_line_FiscalEnd = Color.DarkViolet;
39 | private int _horizontal_line_width = 2;
40 | private Color _color_horizontal_line_FiscalEnd = Color.DarkViolet;
41 | private DashStyle _horizontal_dashstyle = DashStyle.Dash;
42 | private DashStyle _vertical_dashstyle = DashStyle.Dash;
43 |
44 | private int _year = 0;
45 |
46 | #endregion
47 |
48 |
49 | protected override void OnInit()
50 | {
51 | //Add(new OutputDescriptor(Color.FromKnownColor(KnownColor.Orange), "MyPlot1"));
52 | IsOverlay = true;
53 | }
54 |
55 | protected override void OnBarsRequirements()
56 | {
57 | //Print("InitRequirements");
58 | }
59 |
60 |
61 | protected override void OnStart()
62 | {
63 | CalculateOnClosedBar = true;
64 | IsOverlay = true;
65 | }
66 |
67 | protected override void OnCalculate()
68 | {
69 | if (_year == 0)
70 | {
71 | _year = Time[0].Year;
72 | }
73 |
74 | //DateTime lastDayOfYear = new DateTime(Time[0].Year + 1, 1, 1).AddDays(-1);
75 |
76 | if (_year < Time[0].Year)
77 | {
78 | AddChartVerticalLine("vline" + Time[0].Date.ToString(), 0, this.Color_Vertical_Line_FiscalEnd, this.Vertical_DashStyle, this.Vertical_Line_Width);
79 | //AddChartText("txt" + Time[0].Date.ToString(), Time[0].Year.ToString(), ProcessingBarIndexes[0] - Bars.Count() + 1, Low[0], this.Color_Horizontal_Line_FiscalEnd);
80 | AddChartText("txt" + Time[0].Date.ToString(), Time[0].Year.ToString(), ProcessingBarIndexes[0] - Chart.LastBarVisible + 1, Close[0], this.Color_Horizontal_Line_FiscalEnd);
81 | AddChartLine("hline" + Time[0].ToString(), 0, Close[0], ProcessingBarIndexes[0]-Bars.Count()+1, Close[0], this.Color_Horizontal_Line_FiscalEnd);
82 | _year = Time[0].Year;
83 |
84 | }
85 |
86 | }
87 |
88 |
89 |
90 | public override string ToString()
91 | {
92 | return "Fiscal Year End (I)";
93 | }
94 |
95 | public override string DisplayName
96 | {
97 | get
98 | {
99 | return "Fiscal Year End (I)";
100 | }
101 | }
102 |
103 |
104 | ///
105 | /// True if the periodicity of the data feed is correct for this indicator.
106 | ///
107 | ///
108 | public bool DatafeedPeriodicityIsValid(ITimeFrame timeframe)
109 | {
110 | TimeFrame tf = (TimeFrame)timeframe;
111 | if (tf.Periodicity == DatafeedHistoryPeriodicity.Day && tf.PeriodicityValue == 1)
112 | {
113 | return true;
114 | }
115 | else
116 | {
117 | return false;
118 | }
119 | }
120 |
121 |
122 |
123 |
124 | #region Properties
125 |
126 | ///
127 | ///
128 | [Description("Select the Dash Style for the vertical line.")]
129 | [Category("Color")]
130 | [DisplayName("Dash Style Vertical")]
131 | public DashStyle Vertical_DashStyle
132 | {
133 | get { return _vertical_dashstyle; }
134 | set { _vertical_dashstyle = value; }
135 | }
136 |
137 | ///
138 | ///
139 | [Description("Select the Dash Style for the horizontal line.")]
140 | [Category("Color")]
141 | [DisplayName("Dash Style Horizontal")]
142 | public DashStyle Horizontal_DashStyle
143 | {
144 | get { return _horizontal_dashstyle; }
145 | set { _horizontal_dashstyle = value; }
146 | }
147 |
148 | ///
149 | ///
150 | [Description("Select the width for the vertical line.")]
151 | [Category("Color")]
152 | [DisplayName("Width Vertical")]
153 | public int Vertical_Line_Width
154 | {
155 | get { return _vertical_line_width; }
156 | set { _vertical_line_width = value; }
157 | }
158 |
159 | ///
160 | ///
161 | [Description("Select the width for the horizontal line.")]
162 | [Category("Color")]
163 | [DisplayName("Width Horizontal")]
164 | public int Horizontal_Line_Width
165 | {
166 | get { return _horizontal_line_width; }
167 | set { _horizontal_line_width = value; }
168 | }
169 |
170 | ///
171 | ///
172 | [Description("Select Color for the vertical line.")]
173 | [Category("Color")]
174 | [DisplayName("Color Vertical")]
175 | public Color Color_Vertical_Line_FiscalEnd
176 | {
177 | get { return _color_vertical_line_FiscalEnd; }
178 | set { _color_vertical_line_FiscalEnd = value; }
179 | }
180 |
181 |
182 | // Serialize Color object
183 | [Browsable(false)]
184 | public string Color_Vertical_Line_FiscalEndSerialize
185 | {
186 | get { return SerializableColor.ToString(_color_vertical_line_FiscalEnd); }
187 | set { _color_vertical_line_FiscalEnd = SerializableColor.FromString(value); }
188 | }
189 |
190 | ///
191 | ///
192 | [Description("Select Color for the horizontal line.")]
193 | [Category("Color")]
194 | [DisplayName("Color horizontal")]
195 | public Color Color_Horizontal_Line_FiscalEnd
196 | {
197 | get { return _color_horizontal_line_FiscalEnd; }
198 | set { _color_horizontal_line_FiscalEnd = value; }
199 | }
200 |
201 |
202 | // Serialize Color object
203 | [Browsable(false)]
204 | public string Color_Horizontal_Line_FiscalEndSerialize
205 | {
206 | get { return SerializableColor.ToString(_color_horizontal_line_FiscalEnd); }
207 | set { _color_horizontal_line_FiscalEnd = SerializableColor.FromString(value); }
208 | }
209 |
210 |
211 |
212 |
213 | #endregion
214 | }
215 | }
--------------------------------------------------------------------------------
/Indicator/TrendTemplate_MarkMinervini_Indicator.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.ComponentModel;
4 | using System.Drawing;
5 | using System.Drawing.Drawing2D;
6 | using System.Linq;
7 | using System.Xml;
8 | using System.Xml.Serialization;
9 | using AgenaTrader.API;
10 | using AgenaTrader.Custom;
11 | using AgenaTrader.Plugins;
12 | using AgenaTrader.Helper;
13 |
14 | ///
15 | /// Version: 1.1.0
16 | /// -------------------------------------------------------------------------
17 | /// Simon Pucher 2016
18 | /// -------------------------------------------------------------------------
19 | /// This indicator provides trend template by Mark Minervini signals http://www.stockfetcher.com/forums2/Filter-Exchange/Trend-Template-by-Mark-Minervini/125969
20 | /// -------------------------------------------------------------------------
21 | /// ****** Important ******
22 | /// To compile this script without any error you also need access to the utility indicator to use global source code elements.
23 | /// You will find this script on GitHub: https://github.com/simonpucher/AgenaTrader/blob/master/Utility/GlobalUtilities_Utility.cs
24 | /// -------------------------------------------------------------------------
25 | /// Namespace holds all indicators and is required. Do not change it.
26 | ///
27 | namespace AgenaTrader.UserCode
28 | {
29 |
30 | [Description("Enter the description for the new custom indicator here")]
31 | public class TrendTemplate_MarkMinervini_Indicator : UserIndicator
32 | {
33 |
34 | private bool ErrorOccured = false;
35 |
36 |
37 | protected override void OnInit()
38 | {
39 | Add(new OutputDescriptor(Color.FromKnownColor(KnownColor.Red), "MyPlot1"));
40 | Add(new OutputDescriptor(Color.FromKnownColor(KnownColor.Orange), "MyPlot2"));
41 | Add(new OutputDescriptor(Color.FromKnownColor(KnownColor.Blue), "MyPlot3"));
42 | CalculateOnClosedBar = true;
43 | this.IsOverlay = true;
44 | }
45 |
46 | protected override void OnStart()
47 | {
48 | base.OnStart();
49 |
50 | this.ErrorOccured = false;
51 | }
52 |
53 | protected override void OnCalculate()
54 | {
55 |
56 | this.MyPlot1.Set(SMA(50)[0]);
57 | this.MyPlot2.Set(SMA(150)[0]);
58 | this.MyPlot3.Set(SMA(200)[0]);
59 |
60 | //Lets call the calculate method and save the result with the trade action
61 | ResultValue returnvalue = this.calculate(Close);
62 |
63 | //If the calculate method was not finished we need to stop and show an alert message to the user.
64 | if (returnvalue.ErrorOccured)
65 | {
66 | //Display error just one time
67 | if (!this.ErrorOccured)
68 | {
69 | GlobalUtilities.DrawAlertTextOnChart(this, Const.DefaultStringErrorDuringCalculation);
70 | this.ErrorOccured = true;
71 | }
72 | return;
73 | }
74 |
75 |
76 | //Entry
77 | if (returnvalue.Entry.HasValue)
78 | {
79 | switch (returnvalue.Entry)
80 | {
81 | case OrderDirection.Buy:
82 | //AddChartDot("ArrowLong_Entry" + Bars[0].Time.Ticks, true, Bars[0].Time, Bars[0].Open, Color.LightGreen);
83 | //this.MyPlot1.Set(1);
84 | AddChartArrowUp("ArrowLong_Entry" + +Bars[0].Time.Ticks, this.IsAutoAdjustableScale, 0, Bars[0].Low, Color.LightGreen);
85 | break;
86 | }
87 | }
88 | else
89 | {
90 | //Value was null so nothing to do.
91 | //this.MyPlot1.Set(0);
92 | }
93 |
94 | }
95 |
96 |
97 | public ResultValue calculate(IDataSeries input)
98 | {
99 | //Create a return object
100 | ResultValue returnvalue = new ResultValue();
101 |
102 | //try catch block with all calculations
103 | try
104 | {
105 |
106 | /*
107 | The Trend Template is a set of selection criteria by Market Wizard Mark Minervini. Here are the rules:
108 |
109 | 1. The current stock price is above both the 150-day (30-week) and the 200-day (40-week) moving average price lines.
110 | 2. The 150-day moving average is above the 200-day moving average.
111 | 3. The 200-day moving average line is trending up for at least 1 month (preferably 4�5 months minimum in most cases).
112 | 4. The 50-day (10-week) moving average is above both the 150-day and 200-day moving averages.
113 | 5. The current stock price is trading above the 50-day moving average.
114 | 6. The current stock price is at least 30 percent above its 52-week low. (Many of the best selections will be 100 percent, 300 percent, or greater above their 52-week low before they emerge from a solid consolidation period and mount a large scale advance.)
115 | 7. The current stock price is within at least 25 percent of its 52-week high (the closer to a new high the better).
116 | 8. The relative strength ranking (as reported in Investor�s Business Daily) is no less than 70, and preferably in the 80s or 90s, which will generally be the case with the better selections.
117 |
118 | StockFetcher Code:
119 |
120 | Close is above MA(50)
121 | MA(50) is above MA(150)
122 | MA(150) is above MA(200)
123 | MA(200) is increasing for 1 month
124 | Close divided by 260 day low is above 1.3
125 | Close divided by 260 day high is above 0.75
126 | Relative strength(^SPX,90) is above 1.0
127 | */
128 |
129 | if (input[0] > SMA(input, 50)[0] && SMA(input, 50)[0] > SMA(input, 150)[0] && SMA(input, 150)[0] > SMA(input, 200)[0] && IsSeriesRising(SMA(input, 200))
130 | && input[0] / LowestLowPrice(input, 260)[0] > 1.3 && input[0] / HighestHighPrice(input, 260)[0] > 0.75)
131 | {
132 | returnvalue.Entry = OrderDirection.Buy;
133 | }
134 | else
135 | {
136 | returnvalue.Exit = null;
137 | }
138 |
139 | }
140 | catch (Exception)
141 | {
142 | //If this method is called via a strategy or a condition we need to log the error.
143 | returnvalue.ErrorOccured = true;
144 | }
145 |
146 |
147 | //return the result object
148 | return returnvalue;
149 | }
150 |
151 |
152 | public override string ToString()
153 | {
154 | return "TT Mark Minervini (I)";
155 | }
156 |
157 | public override string DisplayName
158 | {
159 | get
160 | {
161 | return "TT Mark Minervini (I)";
162 | }
163 | }
164 |
165 | #region Properties
166 |
167 | [Browsable(false)]
168 | [XmlIgnore()]
169 | public DataSeries MyPlot1
170 | {
171 | get { return Outputs[0]; }
172 | }
173 |
174 | [Browsable(false)]
175 | [XmlIgnore()]
176 | public DataSeries MyPlot2
177 | {
178 | get { return Outputs[1]; }
179 | }
180 |
181 | [Browsable(false)]
182 | [XmlIgnore()]
183 | public DataSeries MyPlot3
184 | {
185 | get { return Outputs[2]; }
186 | }
187 |
188 |
189 | #endregion
190 | }
191 | }
--------------------------------------------------------------------------------
/Condition/Elder_Ray_Bull_and_Bear_Power_Condition.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.ComponentModel;
4 | using System.Drawing;
5 | using System.Drawing.Drawing2D;
6 | using System.Linq;
7 | using System.Xml;
8 | using System.Xml.Serialization;
9 | using AgenaTrader.API;
10 | using AgenaTrader.Custom;
11 | using AgenaTrader.Plugins;
12 | using AgenaTrader.Helper;
13 |
14 | ///
15 | /// Version: 1.2
16 | /// -------------------------------------------------------------------------
17 | /// Simon Pucher 2017
18 | /// -------------------------------------------------------------------------
19 | /// http://vtadwiki.vtad.de/index.php/Elder_Ray_-_Bull_and_Bear_Power
20 | /// -------------------------------------------------------------------------
21 | /// ****** Important ******
22 | /// To compile this script without any error you also need access to the utility indicator to use global source code elements.
23 | /// You will find this script on GitHub: https://raw.githubusercontent.com/simonpucher/AgenaTrader/master/Utilities/GlobalUtilities_Utility.cs
24 | /// -------------------------------------------------------------------------
25 | /// Namespace holds all indicators and is required. Do not change it.
26 | ///
27 | namespace AgenaTrader.UserCode
28 | {
29 | [Category("Script-Trading")]
30 | [Description("Elder Ray - Bull and Bear Power")]
31 | [IsEntryAttribute(true)]
32 | [IsStopAttribute(false)]
33 | [IsTargetAttribute(false)]
34 | [OverrulePreviousStopPrice(false)]
35 | public class Elder_Ray_Bull_and_Bear_Power_Condition : UserScriptedCondition
36 | {
37 | #region Variables
38 |
39 | private int _period = 13;
40 | private ElderRayTyp _ElderRayTyp = ElderRayTyp.BullPower;
41 |
42 | private DoubleSeries ds_bull_power;
43 | private DoubleSeries ds_bear_power;
44 |
45 | private Color _plot0color = Const.DefaultIndicatorColor;
46 | private int _plot0width = Const.DefaultLineWidth;
47 | private DashStyle _plot0dashstyle = Const.DefaultIndicatorDashStyle;
48 | private Color _plot1color = Const.DefaultIndicatorColor_GreyedOut;
49 | private int _plot1width = Const.DefaultLineWidth;
50 | private DashStyle _plot1dashstyle = Const.DefaultIndicatorDashStyle;
51 |
52 | #endregion
53 |
54 | protected override void OnInit()
55 | {
56 | IsEntry = true;
57 | IsStop = false;
58 | IsTarget = false;
59 | Add(new OutputDescriptor(new Pen(this.Plot0Color, this.Plot0Width), OutputSerieDrawStyle.Line, "Occurred"));
60 | Add(new OutputDescriptor(new Pen(this.Plot0Color, this.Plot1Width), OutputSerieDrawStyle.Line, "Entry"));
61 |
62 | ds_bull_power = new DoubleSeries(this);
63 | ds_bear_power = new DoubleSeries(this);
64 |
65 | IsOverlay = false;
66 | CalculateOnClosedBar = true;
67 |
68 | this.RequiredBarsCount = 20;
69 | }
70 |
71 | protected override void OnCalculate()
72 | {
73 | EMA ema = EMA(this.Period);
74 | double bull_power = High[0] - ema[0];
75 | double bear_power = Low[0] - ema[0];
76 | ds_bull_power.Set(bull_power);
77 | ds_bear_power.Set(bear_power);
78 |
79 | int resultsignal = 0;
80 | if (ema[0] > ema[1] && bear_power < 0 && bear_power > ds_bear_power.Get(1))
81 | {
82 | resultsignal = 1;
83 | }
84 |
85 | if (ema[0] < ema[1] && bull_power > 0 && bull_power < ds_bull_power.Get(1))
86 | {
87 | resultsignal = -1;
88 | }
89 |
90 | Occurred.Set(resultsignal);
91 |
92 | PlotColors[0][0] = this.Plot0Color;
93 | OutputDescriptors[0].PenStyle = this.Dash0Style;
94 | OutputDescriptors[0].Pen.Width = this.Plot0Width;
95 |
96 | PlotColors[1][0] = this.Plot1Color;
97 | OutputDescriptors[1].PenStyle = this.Dash1Style;
98 | OutputDescriptors[1].Pen.Width = this.Plot1Width;
99 | }
100 |
101 |
102 | public override string DisplayName
103 | {
104 | get
105 | {
106 | return "Elder Ray (C)";
107 | }
108 | }
109 |
110 |
111 | public override string ToString()
112 | {
113 | return "Elder Ray (C)";
114 |
115 | }
116 |
117 | #region Properties
118 |
119 | [Browsable(false)]
120 | [XmlIgnore()]
121 | public DataSeries Occurred
122 | {
123 | get { return Outputs[0]; }
124 | }
125 |
126 | [Browsable(false)]
127 | [XmlIgnore()]
128 | public DataSeries Entry
129 | {
130 | get { return Outputs[1]; }
131 | }
132 |
133 | public override IList GetEntries()
134 | {
135 | return new[]{Entry};
136 | }
137 |
138 | [Description("Type of ElderRayTyp.")]
139 | [InputParameter]
140 | [DisplayName("ElderRayTyp")]
141 | public ElderRayTyp ElderRayTyp
142 | {
143 | get { return _ElderRayTyp; }
144 | set { _ElderRayTyp = value; }
145 |
146 | }
147 | [Description("Period of the EMA.")]
148 | [InputParameter]
149 | [DisplayName("Period")]
150 | public int Period
151 | {
152 | get { return _period; }
153 | set { _period = value; }
154 |
155 | }
156 |
157 | ///
158 | ///
159 | [Description("Select Color for the indicator.")]
160 | [Category("Plots")]
161 | [DisplayName("Color")]
162 | public Color Plot0Color
163 | {
164 | get { return _plot0color; }
165 | set { _plot0color = value; }
166 | }
167 | // Serialize Color object
168 | [Browsable(false)]
169 | public string Plot0ColorSerialize
170 | {
171 | get { return SerializableColor.ToString(_plot0color); }
172 | set { _plot0color = SerializableColor.FromString(value); }
173 | }
174 |
175 | ///
176 | ///
177 | [Description("Line width for indicator.")]
178 | [Category("Plots")]
179 | [DisplayName("Line width")]
180 | public int Plot0Width
181 | {
182 | get { return _plot0width; }
183 | set { _plot0width = Math.Max(1, value); }
184 | }
185 |
186 | ///
187 | ///
188 | [Description("DashStyle for indicator.")]
189 | [Category("Plots")]
190 | [DisplayName("DashStyle")]
191 | public DashStyle Dash0Style
192 | {
193 | get { return _plot0dashstyle; }
194 | set { _plot0dashstyle = value; }
195 | }
196 |
197 | ///
198 | ///
199 | [Description("Select color for the indicator.")]
200 | [Category("Plots")]
201 | [DisplayName("Color")]
202 | public Color Plot1Color
203 | {
204 | get { return _plot1color; }
205 | set { _plot1color = value; }
206 | }
207 | // Serialize Color object
208 | [Browsable(false)]
209 | public string Plot1ColorSerialize
210 | {
211 | get { return SerializableColor.ToString(_plot1color); }
212 | set { _plot1color = SerializableColor.FromString(value); }
213 | }
214 |
215 | ///
216 | ///
217 | [Description("Line width for indicator.")]
218 | [Category("Plots")]
219 | [DisplayName("Line width")]
220 | public int Plot1Width
221 | {
222 | get { return _plot1width; }
223 | set { _plot1width = Math.Max(1, value); }
224 | }
225 |
226 | ///
227 | ///
228 | [Description("DashStyle for indicator.")]
229 | [Category("Plots")]
230 | [DisplayName("DashStyle")]
231 | public DashStyle Dash1Style
232 | {
233 | get { return _plot1dashstyle; }
234 | set { _plot1dashstyle = value; }
235 | }
236 |
237 | #endregion
238 | }
239 | }
--------------------------------------------------------------------------------
/Indicator/PinBar_Indicator.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.ComponentModel;
4 | using System.Drawing;
5 | using System.Drawing.Drawing2D;
6 | using System.Linq;
7 | using System.Xml;
8 | using System.Xml.Serialization;
9 | using AgenaTrader.API;
10 | using AgenaTrader.Custom;
11 | using AgenaTrader.Plugins;
12 | using AgenaTrader.Helper;
13 |
14 | ///
15 | /// Version: 1.2
16 | /// -------------------------------------------------------------------------
17 | /// Simon Pucher 2016
18 | /// -------------------------------------------------------------------------
19 | /// http://priceaction.com/price-action-university/strategies/pin-bar/
20 | /// -------------------------------------------------------------------------
21 | /// ****** Important ******
22 | /// To compile this indicator without any error you also need access to the utility indicator to use these global source code elements.
23 | /// You will find this indicator on GitHub: https://raw.githubusercontent.com/simonpucher/AgenaTrader/master/Utilities/GlobalUtilities_Utility.cs
24 | /// -------------------------------------------------------------------------
25 | /// Namespace holds all indicators and is required. Do not change it.
26 | ///
27 | namespace AgenaTrader.UserCode
28 | {
29 |
30 |
31 | [Description("Show the Pin Bar Signal.")]
32 | public class PinBar_indicator : UserIndicator
33 | {
34 | private bool _showarrows = true;
35 | private bool _showindicatorbox = true;
36 |
37 | private int _percentage = 50;
38 |
39 | private Color _color_arrow_long_signal = Const.DefaultArrowLongColor;
40 | private Color _color_arrow_short_signal = Const.DefaultArrowShortColor;
41 | private Color _plot0color = Const.DefaultIndicatorColor;
42 | private int _plot0width = Const.DefaultLineWidth;
43 | private DashStyle _plot0dashstyle = Const.DefaultIndicatorDashStyle;
44 |
45 | protected override void OnInit()
46 | {
47 | Add(new OutputDescriptor(new Pen(this.Plot0Color, this.Plot0Width), OutputSerieDrawStyle.Line, "PinBar_Indicator"));
48 | IsOverlay = false;
49 | CalculateOnClosedBar = true;
50 | IsAutoAdjustableScale = true;
51 |
52 | //this.RequiredBarsCount = 200;
53 |
54 |
55 | }
56 |
57 | protected override void OnCalculate()
58 | {
59 | int signal = 0;
60 | //Bars[0].IsGrowing &&
61 | if ((Bars[0].TailBottom/Bars[0].Range) > (this.Percentage/100.0))
62 | {
63 | signal = 1;
64 | if (this.ShowArrows)
65 | {
66 | AddChartArrowUp("ArrowLong_PinBar" + +Bars[0].Time.Ticks, this.IsAutoAdjustableScale, 0, Bars[0].Low, this.ColorArrowLongSignal);
67 | }
68 | }
69 | else if ((Bars[0].TailTop/Bars[0].Range) > (this.Percentage/100.0))
70 | {
71 | signal = -1;
72 | if (this.ShowArrows)
73 | {
74 | AddChartArrowDown("ArrowShort_PinBar" + +Bars[0].Time.Ticks, this.IsAutoAdjustableScale, 0, Bars[0].High, this.ColorArrowShortSignal);
75 | }
76 | }
77 |
78 | if (ShowIndicatorBox)
79 | {
80 | PlotLine.Set(signal);
81 | }
82 |
83 |
84 |
85 | PlotColors[0][0] = this.Plot0Color;
86 | OutputDescriptors[0].PenStyle = this.Dash0Style;
87 | OutputDescriptors[0].Pen.Width = this.Plot0Width;
88 | }
89 |
90 |
91 |
92 | public override string ToString()
93 | {
94 | return "Pin Bar (I)";
95 | }
96 |
97 | public override string DisplayName
98 | {
99 | get
100 | {
101 | return "Pin Bar (I)";
102 | }
103 | }
104 |
105 | #region Properties
106 |
107 | [Browsable(false)]
108 | [XmlIgnore()]
109 | public DataSeries PlotLine
110 | {
111 | get { return Outputs[0]; }
112 | }
113 |
114 | ///
115 | ///
116 | [Description("If true then arrows are drawn on the chart.")]
117 | [Category("Plots")]
118 | [DisplayName("Show arrows")]
119 | public bool ShowArrows
120 | {
121 | get { return _showarrows; }
122 | set { _showarrows = value; }
123 | }
124 |
125 | ///
126 | ///
127 | [Description("If true then indicator box drawn on the chart.")]
128 | [Category("Plots")]
129 | [DisplayName("Show indicatorbox")]
130 | public bool ShowIndicatorBox
131 | {
132 | get { return _showindicatorbox; }
133 | set { _showindicatorbox = value; }
134 | }
135 |
136 | ///
137 | ///
138 | [Description("Select Color for the long arrows signal.")]
139 | [Category("Plots")]
140 | [DisplayName("Signal Long")]
141 | public Color ColorArrowLongSignal
142 | {
143 | get { return _color_arrow_long_signal; }
144 | set { _color_arrow_long_signal = value; }
145 | }
146 | // Serialize Color object
147 | [Browsable(false)]
148 | public string ColorArrowLongSignalSerialize
149 | {
150 | get { return SerializableColor.ToString(_color_arrow_long_signal); }
151 | set { _color_arrow_long_signal = SerializableColor.FromString(value); }
152 | }
153 |
154 |
155 | ///
156 | ///
157 | [Description("Select Color for the short arrows signal.")]
158 | [Category("Plots")]
159 | [DisplayName("Signal Short")]
160 | public Color ColorArrowShortSignal
161 | {
162 | get { return _color_arrow_short_signal; }
163 | set { _color_arrow_short_signal = value; }
164 | }
165 | // Serialize Color object
166 | [Browsable(false)]
167 | public string ColorArrowShortSignalSerialize
168 | {
169 | get { return SerializableColor.ToString(_color_arrow_short_signal); }
170 | set { _color_arrow_short_signal = SerializableColor.FromString(value); }
171 | }
172 |
173 | ///
174 | ///
175 | [Description("Select Color for the indicator.")]
176 | [Category("Plots")]
177 | [DisplayName("Plot Color")]
178 | public Color Plot0Color
179 | {
180 | get { return _plot0color; }
181 | set { _plot0color = value; }
182 | }
183 | // Serialize Color object
184 | [Browsable(false)]
185 | public string Plot0ColorSerialize
186 | {
187 | get { return SerializableColor.ToString(_plot0color); }
188 | set { _plot0color = SerializableColor.FromString(value); }
189 | }
190 |
191 | ///
192 | ///
193 | [Description("Line width for indicator.")]
194 | [Category("Plots")]
195 | [DisplayName("Plot Line width")]
196 | public int Plot0Width
197 | {
198 | get { return _plot0width; }
199 | set { _plot0width = Math.Max(1, value); }
200 | }
201 |
202 | ///
203 | ///
204 | [Description("DashStyle for indicator.")]
205 | [Category("Plots")]
206 | [DisplayName("Plot DashStyle")]
207 | public DashStyle Dash0Style
208 | {
209 | get { return _plot0dashstyle; }
210 | set { _plot0dashstyle = value; }
211 | }
212 |
213 | ///
214 | ///
215 | [Description("The pertage of the lenght of the tail.")]
216 | [Category("Plots")]
217 | [DisplayName("Percentage Tail")]
218 | public int Percentage
219 | {
220 | get { return _percentage; }
221 | set { _percentage = Math.Max(1, Math.Min(value, 100)); }
222 | }
223 |
224 |
225 |
226 | #endregion
227 | }
228 | }
--------------------------------------------------------------------------------
/Condition/RunningWithTheWolves_Condition.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.ComponentModel;
4 | using System.Drawing;
5 | using System.Drawing.Drawing2D;
6 | using System.Linq;
7 | using System.Xml;
8 | using System.Xml.Serialization;
9 | using AgenaTrader.API;
10 | using AgenaTrader.Custom;
11 | using AgenaTrader.Plugins;
12 | using AgenaTrader.Helper;
13 |
14 |
15 | ///
16 | /// Version: in progress
17 | /// -------------------------------------------------------------------------
18 | /// Simon Pucher 2016
19 | /// Christian Kovar 2016
20 | /// -------------------------------------------------------------------------
21 | /// Golden & Death cross: http://www.investopedia.com/ask/answers/121114/what-difference-between-golden-cross-and-death-cross-pattern.asp
22 | /// -------------------------------------------------------------------------
23 | /// ****** Important ******
24 | /// To compile this script without any error you also need access to the utility indicator to use these global source code elements.
25 | /// You will find this indicator on GitHub: https://raw.githubusercontent.com/simonpucher/AgenaTrader/master/Utilities/GlobalUtilities_Utility.cs
26 | /// -------------------------------------------------------------------------
27 | /// Namespace holds all indicators and is required. Do not change it.
28 | ///
29 | namespace AgenaTrader.UserCode
30 | {
31 | [Category("Script-Trading")]
32 | [Description("Use SMA or EMA crosses to find trends.")]
33 | [IsEntryAttribute(true)]
34 | [IsStopAttribute(false)]
35 | [IsTargetAttribute(false)]
36 | [OverrulePreviousStopPrice(false)]
37 | public class RunningWithTheWolves_Condition : UserScriptedCondition
38 | {
39 | #region Variables
40 |
41 | //input
42 | private Enum_RunningWithTheWolves_Indicator_MA _MA_Selected = Enum_RunningWithTheWolves_Indicator_MA.SMA;
43 |
44 | private int _ma_slow = 200;
45 | private int _ma_medium = 100;
46 | private int _ma_fast = 20;
47 |
48 |
49 | private bool _IsShortEnabled = true;
50 | private bool _IsLongEnabled = true;
51 | //output
52 |
53 | //internal
54 | private RunningWithTheWolves_Indicator _RunningWithTheWolves_Indicator = null;
55 |
56 |
57 | #endregion
58 |
59 | protected override void OnInit()
60 | {
61 | IsEntry = true;
62 | IsStop = false;
63 | IsTarget = false;
64 | Add(new OutputDescriptor(Const.DefaultIndicatorColor, "Occurred"));
65 | Add(new OutputDescriptor(Const.DefaultIndicatorColor, "Entry"));
66 |
67 | IsOverlay = false;
68 | CalculateOnClosedBar = true;
69 |
70 | //For SMA200 we need at least 200 Bars.
71 | this.RequiredBarsCount = 200;
72 | }
73 |
74 | protected override void OnBarsRequirements()
75 | {
76 | base.OnBarsRequirements();
77 |
78 | }
79 |
80 |
81 | protected override void OnStart()
82 | {
83 | base.OnStart();
84 |
85 | //Init our indicator to get code access
86 | this._RunningWithTheWolves_Indicator = new RunningWithTheWolves_Indicator();
87 | }
88 |
89 |
90 |
91 | protected override void OnCalculate()
92 | {
93 |
94 | //calculate data
95 | OrderDirection_Enum? resultdata = this._RunningWithTheWolves_Indicator.calculate(InSeries, this.MA_Selected, this.MA_Fast, this.MA_Medium, this.MA_Slow);
96 | if (resultdata.HasValue)
97 | {
98 | switch (resultdata)
99 | {
100 | case OrderDirection_Enum.OpenLong:
101 | Occurred.Set(1);
102 | //Entry.Set(InSeries[0]);
103 | break;
104 | case OrderDirection_Enum.OpenShort:
105 | Occurred.Set(-1);
106 | //Entry.Set(InSeries[0]);
107 | break;
108 | //case OrderDirection.Buy:
109 | // break;
110 | //case OrderDirection.Sell:
111 | // break;
112 | default:
113 | //nothing to do
114 | Occurred.Set(0);
115 | //Entry.Set(InSeries[0]);
116 | break;
117 | }
118 | }
119 | else
120 | {
121 | Occurred.Set(0);
122 | }
123 |
124 | }
125 |
126 |
127 | public override string ToString()
128 | {
129 | return "Running with the wolves (C)";
130 | }
131 |
132 | public override string DisplayName
133 | {
134 | get
135 | {
136 | return "Running with the wolves (C)";
137 | }
138 | }
139 |
140 |
141 |
142 |
143 | #region Properties
144 |
145 |
146 | #region InSeries
147 |
148 |
149 | ///
150 | ///
151 | [Description("Select the type of MA you would like to use")]
152 | [InputParameter]
153 | [DisplayName("Type of MA")]
154 | public Enum_RunningWithTheWolves_Indicator_MA MA_Selected
155 | {
156 | get { return _MA_Selected; }
157 | set
158 | {
159 | _MA_Selected = value;
160 | }
161 | }
162 |
163 |
164 | ///
165 | ///
166 | [Description("Period for the slow mean average")]
167 | [InputParameter]
168 | [DisplayName("MA Slow")]
169 | public int MA_Slow
170 | {
171 | get { return _ma_slow; }
172 | set
173 | {
174 | _ma_slow = value;
175 | }
176 | }
177 |
178 | ///
179 | ///
180 | [Description("Period for the medium mean average")]
181 | [InputParameter]
182 | [DisplayName("MA Medium")]
183 | public int MA_Medium
184 | {
185 | get { return _ma_medium; }
186 | set
187 | {
188 | _ma_medium = value;
189 | }
190 | }
191 |
192 | ///
193 | ///
194 | [Description("Period for the fast mean average")]
195 | [InputParameter]
196 | [DisplayName("MA Fast")]
197 | public int MA_Fast
198 | {
199 | get { return _ma_fast; }
200 | set
201 | {
202 | _ma_fast = value;
203 | }
204 | }
205 |
206 |
207 | ///
208 | ///
209 | [Description("If true it is allowed to go long")]
210 | [InputParameter]
211 | [DisplayName("Allow Long")]
212 | public bool IsLongEnabled
213 | {
214 | get { return _IsLongEnabled; }
215 | set { _IsLongEnabled = value; }
216 | }
217 |
218 |
219 | ///
220 | ///
221 | [Description("If true it is allowed to go short")]
222 | [InputParameter]
223 | [DisplayName("Allow Short")]
224 | public bool IsShortEnabled
225 | {
226 | get { return _IsShortEnabled; }
227 | set { _IsShortEnabled = value; }
228 | }
229 |
230 |
231 | #endregion
232 |
233 |
234 | #region Output
235 |
236 | [Browsable(false)]
237 | [XmlIgnore()]
238 | public DataSeries Occurred
239 | {
240 | get { return Outputs[0]; }
241 | }
242 |
243 | [Browsable(false)]
244 | [XmlIgnore()]
245 | public DataSeries Entry
246 | {
247 | get { return Outputs[1]; }
248 | }
249 |
250 | public override IList GetEntries()
251 | {
252 | return new[] { Entry };
253 | }
254 |
255 |
256 | #endregion
257 |
258 | #region Internals
259 |
260 |
261 |
262 | #endregion
263 |
264 |
265 | #endregion
266 | }
267 | }
--------------------------------------------------------------------------------