Teknik Analiz Dünyasına Hoşgeldiniz. Paylaşmak Güzeldir.

Yayından kaldırmak istediğiniz formüller için algoritmabul@gmail.com ile iletişime geçebilirsiniz... 

  • DİKKAT: Formüller, Sistemler sadece eğitim amaçlıdır. Alım satım, olası anapara kaybı ve diğer kayıplar dahil olmak üzere "YÜKSEK RİSK" içerir.
  • “Hiç zengin olan bir teknik analist görmedim” diyenlere hep gülmüşümdür. Bu kadar saçma ve küstahça bir şey daha duymadım. Dokuz yıl boyunca temel analiz kullandıktan sonra, teknik analizci olarak zengin oldum. “ (Marty Schwartz)

Al Sat Sistemi 25x25 Bond Trading System by Charles LeBeau and Terence Tan

Bir ticaret sistemi, finansal piyasalarda alım satımla ilgili belirli kurallara sahip belirli ayarlara dayanır. Bir dizi işlemin istatistiksel bir analizini alır ve ondan kar sağlayan geçmiş performansları içerir. Bu stratejiyi bir ticaret sistemi olarak adlandırmadan önce, başarısını ve bir süre başarılı kalma yeteneğini garanti altına almak için bir dizi teste tabi tutulur. Bir ticaret stratejisi asla sabit bir karı garanti etmez. Kısa sürede kar etmek için "al" ve "sat" sinyalleri sağlayacak belirli algoritmalardan veya ayarlamalardan oluşur. Pazar her zaman değiştiği ve algoritmalarda veya ticaret sisteminde yapılan yeni ayarlamaların da değişmesi gerektiğinden, asla sabit bir kar oranını garanti etmez. Alım satım sistemleri genellikle zaman içinde görülür, hisse senetleri ve forex piyasaları sürekli alım veya satım sinyalleri verir.

algoritma

eiπ + 1 = 0
Algorithmist
Algoritma
Katılım
23 Eki 2020
Mesajlar
1,797
more detail at http://www.traderclub.com

This system is provided free to people who join the System Traders Club.It is a profitable Bond Trading System that we supply in order to demonstrate the quality of our work, and as an example of the documentation that comes with each of our systems.

Gary Randal mailto:Randall_Gary@tmac.com has ported this system into MetaStock format. His comments and code for MetaStock follow our normal system Documentation. A Rrade by Trade Report concludes the document

"25 x 25" Bond Trading System by Charles LeBeau and Terence Tan

Introduction

In this report we will present several useful concepts for trading the Bond futures markets, and illustrate these concepts with a Bond trading system that we have called the "25 x 25". The "25 x 25" system is a long-only trend-following system designed for the Bond market which has made hypothetical profits of $53,000 over the last 10 years of historical data, with an accuracy rateof 76%.

Aims of the System Traders Club

Before we present the details of the system, we will review some of the goals we hope to achieve for the System Traders Club.

First, we do not hope to reveal any "holy grails" to trading. Many of the systems that you will see in the System Club reports include indicators that you may already be familiar with, or that can be easily programmed into the computer. In addition, you will find that many of these systems are not perfect: they will all have drawdowns, and none of them are 100% accurate over the long run. However, we think they deserve serious consideration for actual real-time trading applications. We realize that in the business of trading the futures markets there is no single method that makes money automatically. We believe that a combination of logical system concepts and reasonable entry and exit strategies greatly increases the probability of success in trading. We hope to be able to communicate to you, through these reports, many ofthe concepts that we have learned over the years.

Second, we hope that these reports will serve both an informative as well as a practical purpose. We will share with you lessons that we have accumulated over the years regarding trading strategies and techniques that have worked in various markets, and the logic behind them. You may also want to viewthe systems presented as illustrations of general principles and conceptsin systematic trading of the futures markets. We hope that you may also applythese concepts to your own favorite markets and time-frames. We would welcomeany feedback you may have on possible improvements and different applicationsof these systems.

Third, we intend to provide many different systems and market combinations in our reports. Multiple systems can be combined together in a portfolioto generate more frequent trades and higher returns than any single system.We believe in diversification; but we also realize that diversification isa function of personality and preference. For this reason, we will be offering many different types of systems, from which you will be able to select systems that suit your personality and preference and combine them into your owndiversified trading portfolio.

"25 x 25" System Rules

We will concisely present the system rules first, and then elaborate andexplain the concept and logic behind some of the more important trading techniques represented in the system:

To go long in the Bond market, three conditions must be met.

1. The 14-day +DI must be above the 14-day -DI.
2. The 14-day ADX must be above 20.
3. The 4-day RSI must be below 50.

If these three conditions are met then buy tomorrow only if and when prices rise 18 ticks (18/32) above today's close. Enter on a buy stop order.

After a trade has been entered, place a sell stop at whichever of the positions below are closest to the market price.
  1. A stop order at $2,500 below the entry price.
  2. Or a stop order at the lowest low of the last 25 days.
  3. After 25 days (count entry day as day 1), change stop #2 from the lowest low of 25 days to the lowest low of 2 days.
  4. Regardless of the number of days in the trade, after any close where the open profit is greater than 5 Average True Ranges the exit stop should be at the lowest low of 2 days. (Important: use 45 days to calculate the ATR)
Historical Results

Table 1 shows the historical results of trading 1 contract on the systemtested over 10 years of data. For the testing purposes, we used continuousback-adjusted daily data. We ignored all night sessions, and all calculationswere based on day-session prices and ranges only. $100 was deducted fromevery trade to simulate the effects of commissions and slippage. The testperiod was from 1/1/88 to 1/16/98 with MaxBarsBack set to 50 to enable adequatesmoothing on the ADX calculations. (MaxBarsBack refers to the number of barsof data necessary to calculate the rules in a system. System rules only beginafter the MaxBarsBack period. The test period includes the MaxBarsBack period,so that no trades are taken for the first 50 trading days.)

Table 1. “25 x 25” System v.2.0 Hypothetical Results (TradeStation format) This system was created originally for Tradestation and then interpreted into MetaStock Format by one of our members. We do not have MetaStock reports.

Total net profit $ 55,112.50 Open position P/L $ 1,875.00
Gross profit $ 64,887.50 Gross loss $-9,775.00

Total # of trades 32 Percent profitable 72%
Number winning trades 23 Number losing trades 9

Largest winning trade $ 5,181.25 Largest losing trade $ -2,600.00
Average winning trade $ 2,821.20 Average losing trade $ -1,086.11
Ratio avg win/avg loss 2.60 Avg trade(win & loss) $ 1,722.27

Max consec. winners 5 Max consec. losers 2
Avg # bars in winners 26 Avg # bars in losers 12

Max intraday drawdown $ -3,381.25
Profit factor 6.64 Max # contracts held 1
Account size required $ 3,381.25 Return on account 1,630%

The hypothetical performance data above was generated using Omega TradeStation, with $100 deducted per trade for commissions and slippage. In our opinion, the "account size required" and "return on account" calculations may notaccurately reflect the actual account size required to trade this systemnor the return to be expected.

PAST PERFORMANCE IS NOT NECESSARILY INDICATIVE OF FUTURE RESULTS.

HYPOTHETICAL OR SIMULATED PERFORMANCE RESULTS HAVE CERTAIN INHERENT LIMITATIONS. UNLIKE AN ACTUAL PERFORMANCE RECORD, SIMULATED RESULTS DO NOT REPRESENT ACTUAL TRADING. ALSO, SINCE THE TRADES HAVE NOT ACTUALLY BEEN EXECUTED, THE RESULTS MAY HAVE UNDER-OR-OVER COMPENSATED FOR THE IMPACT, IF ANY, OF CERTAIN MARKET FACTORS SUCH AS LACK OF LIQUIDITY. SIMULATED TRADING PROGRAMS IN GENERALARE ALSO SUBJECT TO THE FACT THAT THEY ARE DESIGNED WITH THE BENEFIT OF HINDSIGHT. NO REPRESENTATION IS BEING MADE THAT ANY ACCOUNT WILL OR IS LIKELY TO ACHIEVE PROFITS OR LOSSES SIMILAR TO THOSE SHOWN.

System Concept

The concept behind the system is simple. We designed 25 x 25 to be a trend following system that will enter an uptrend during a dip in prices. To do this we will implement three entry strategies. First, there is a trend indicator to identify a strongly uptrending market. Second, there is a shorter term retracement indicator that will identify a small dip in the uptrend which will set up the trade. Third, we have a precise short-term entry signal which will enter the trade when the uptrend resumes.

Trend Indication

For the trend indicator, we employ one of our favorite trend indicators,the Directional Movement Indicator. Specifically we will use the relationship between the +DI (Plus Directional Indicator), -DI (Minus Directional Indicator), and the ADX (Average Directional Movement Index). These indicators were described by Welles Wilder in his book, New Concepts In Technical Trading Systems,and are pre-programmed into most of the modern computerized charting software. The default value chosen by Mr Wilder was 14-days for all the indicators, and this is the value we have chosen for the system.

For our trend indication, we will require that the 14-day +DI must be above the 14-day -DI, and that the value of the ADX must be above 20. The relationship of the +DI to the -DI is a useful way of determining the direction of the intermediate trend; however this definition of trend is inadequate without the inclusion of the ADX which actually measures the strength of the trend. Trend indicators traditionally only indicate whether the trend is up or down, which is not an accurate representation of how the market behaves. As you are aware, markets spend most of their time neither in an uptrend or downtrend, but in a sideways market. By demanding that the ADX be above 20, we effectively filter out these sideways markets, and enable our system to enter duringperiods of relatively strong uptrends. It is important to understand thatthe ADX does not indicate the direction of the trend, merely its strength,which is why we need to combine the strong ADX reading with the DI relationship.

As a general concept it is a good idea to always trade markets accordingto the direction of the intermediate trend. For instance, with our trendindicator installed, the 25 x 25 system made $53,000 over 10 years with anaccuracy of 76%, and had an average trade of $1,829. This indicator includeda requirement for the ADX to be above 20.

To assess the impact of an uptrend in trading the Bond market from the long side, we eliminated the ADX requirement and reversed the rules of the system so that it only took trades when the +DI was below -DI, indicating a downtrend. The results are illuminating: trading the Bond market with all the same entry signals but during a downtrend as defined as -DI being above +DI produced losses of $781 over 10 years of trading, with a dismal accuracy of 29%, an average trade of -$6, and a drawdown of $25,000! You clearly do not wantto be buying the Bond market using this technique in an intermediate downtrend.

We have mentioned the value of the ADX value in assessing the strength of the uptrend. To see the impact of the ADX value, we re-tested the systemto see how it would perform if the ADX were below 20 while maintaining therequirement for the +DI to be above the -DI. When the ADX is below 20 ina prevailing uptrend (as defined by the +DI and -DI relationship), the systemonly made $8,900, was only 47% accurate, and had an average trade of only$595 and a drawdown of $6,500, a significant deterioration of results. Weconclude that an uptrend indication on a trend indicator such as the DI onlygives average results; however, combining the trend indicator with an ADXvalue is significantly superior because the ADX level serves to filter outperiods of sideways markets.

Retracement Indicator

The second indicator we have adopted is the 4-day RSI (Welles Wilder's Relative Strength Index) which we use to identify a short-term dip in the market prices during the prevailing uptrending Bond market. We use the RSI because of its popularity and inclusion in most charting applications. Mr Wilder described a longer-term RSI, and our choice of a 4-day RSI reflects our design intention of identifying short-term retracements that would set up high probability trades. The RSI oscillates between a minimum and maximum value of 0 and 100. When the RSI declines to below 50 (the midpoint), we have defined a short-term decline in the market.

Does the short-term decline, as measured by the 4-day RSI falling below 50 actually make that much difference to trading this market? To study the difference, we ran another test on the system with the exact same rules, but eliminating the 4-day RSI rule. The tests over 10 years of data showed a profit of $22,400 over 51 trades, with an accuracy of 51%, an average trade of $440, and adrawdown of $9,200. The results are striking: by eliminating the retracementindicator and entering the markets at any point during an uptrend, the systemmakes less than half of the profits made when entering on a short-term decline. The average trade declined to less than 25% of the average trade when entering during a retracement! ($440 as compared with $1,800). We concluded therefore that in an uptrending Bond market, waiting for a short-term decline or dip in prices to set up a long trade is preferable to entering the trend on strength.

Entry Trigger

With the +DI, -DI and ADX rules in place, and a short-term market decline measured by the RSI, we have identified a market situation that is highly bullish. What we require next is a very short term indicator that will get us into the market. In our opinion, this particular indicator is the least important. It only serves to time our entry a bit more precisely. In fact, our tests show that you could ignore this entry trigger, and just enter the trade on the opening of the next trading day after the ADX and RSI setups are present, to get a profit of $49,600 over 10 years and 57% accuracy with an average trade of $974, a drawdown of $6,000, and a profit factor of 2.63! Entering on the open would have traded 51 times over the last 10 years, significantly more than the 29 trades with our 18-tick entry rule.

But entering on the opening after a decline has its difficulties, especially if the market continues to decline. On a psychological level, many traders (including us) are more comfortable knowing that the market is moving upin the direction of the trade before entering the position. Hence the logicof our entry trigger: to wait till the market proves itself by rallying 18ticks from the previous day's close before we enter the trade. This is asignificant rally, but forcing the prices to rally significantly before enteringenables the system to produce a much higher percentage (76% over 10 years)of winning trades.

There is no particular magic about the 18-tick number. In fact to test the robustness of this entry parameter, we ran a series of tests using the same entry rules, and varying the entry trigger from 2-ticks to 36-ticks above the closing price. The results are presented in Table 2 below.

The most significant fact of the optimization is that all the tests are profitable, which is a good indicator of a parameter robustness. Significantly also,all tests have large average trades exceeding $1,000 per trade, and all tests show profit factors better than 2.50, and no drawdown on any test is greater than $6,000. It probably does not matter how many ticks above the close you decide to take for the entry point. As mentioned previously, even blindly entering on the opening is profitable over the historical data. Also, wecould trade more frequently if we acted on smaller moves above the previousclose, but we would expect to have a lower percentage of winners. For instance,we could have chosen a smaller move of 8 ticks above the close to get a profit of $52,500 on more trades (40 trades), but with a lower accuracy rate (68%) and a slightly higher drawdown ($5,600). Since all tests are profitable,if a trader wishes to deviate from the published system, we will leave itup to the individual trader to decide which profile of trades bests suitshim.

Table 2. Optimization Results on Entry Trigger Parameters



Testing the Entry Technique

Often, when we want to study the effectiveness of an entry technique by itself, we do optimization tests on the entry technique and exit simply at a close X days in the future. This often gives a good indication of the profit potential of any entry technique. The percentage of winning trades is a good indication of the efficiency of the entry technique. Table 3 below presents the results of the entry technique described above, and exiting at the Xth close after the entry. These tests do not include any money management stops or any other risk-management strategies.

Notice that all exits were profitable except an exit on the first close,which amounts to exiting on the close of the day of entry. You certainlydo not want to be day-trading with this trend-following technique! Noticethe high accuracy rates of 85 to 90% when the trade is held 20 days or more.For instance, if you exited each trade on the 22nd close, you would make$54,800 with a 91% accuracy rate and a drawdown of less than $5,500! Andthis is accomplished without any stop! We can conclude that this entry techniquepredicts,with almost 85 to 90 percent accuracy, a resumption of the trendthat lasts between 20 to 25 days

Table 3. Results of the Entry Technique and Exiting on Xth Close.

X NetPrft AvgTrd PFact MaxDD #Trds %Prft



The Exit Techniques

For the exits we have included a $2,500 money management stop, which attempts to limit the worst possible loss sustainable on any particular trade. Weare always most comfortable trading with stops that will limit the maximumdollar loss on any trade, although we realize that this protection may belimited if the market gaps against the position overnight. We have chosen$2,500 as the dollar-stop in this system. This is a large stop designed toavoid whipsaws, and it has only been hit once in the last 10 years. In spiteof the fact that this stop is rarely triggered we believe it is essentialand its presence makes us comfortable. We recommend dollar stops on all systemsto protect against catastrophic losses.

The second exit strategy is a common one: the channel low exit. In this case we have chosen the low of the last 25 market days. Again, the exact number of days is probably unimportant; the concept of trailing a stop at a lowpoint in the market is very popular and has been used successfully by markettechnicians for a long time.

If we merely installed the $2,500 dollar stop and the 25-day channel lowexit, the system makes $43,000 over 10 years of trading, with 18 trades.The average bars in winners is 67, which is a relatively long period, andthe average bars in losers is 14, showing that the trailing exit effectivelycuts losses short and lets profits run. The system is 67% accurate, and hasa huge average trade of $2,400. The ratio of average win to loss with thisexit is 3.78.

While this variant of the system is profitable and tradable on its own, it suffers from several disadvantages: Firstly, it holds trades for a very long period. To take a profit on a winning trade, a trader would have to holdthrough an average of 67 days. This may not be psychologically appealingfor many traders. But secondly, and even worse, the exit is inefficient inthat it frequently gives up large amounts of open profits, since it alwaysrequires the market to reverse to a 25-day low before signalling an exit.We have frequently seen trades give up one-third, or half, or all of theiropen profits before exiting a trade on a trailing channel stop. In additionto suffering a "roller coaster" sensation while waiting for a profitabletrade to retrace to a 25-day low, many winning trades could turn into lossesbecause of the slow exit. This would not make us comfortable in spite ofthe potential profits.

A simple “twist” to the exit strategy allows us to reduce the number of days in the average holding period, increase total profits, increase the accuracy to 72%, and trade more frequently. The technique is this: we will wait patiently for a trade to develop over a specific number of days, using the conventional dollar and channel stops, and then switch to a tighter channel stop to effect a quick exit. Specifically, we will install the 25-day channel low exit for the first 25 days of a trade (count the day of entry as day 1), and on the 26th day, we will change the exit technique to a much tighter stop at the lowest low of the last 2 days. This dramatic hange will obviously trigger a more sensitive exit but will still allow us to maintain our position in a fast moving market.

We must also remember that our goal in trading is most directly related to the size of the profit and not to the average holding period. Holding a trade longer may be best in most cases but not in all. For those cases where we are fortunate enough to have a large profit in less than 25 days we wantto raise our stop to protect those profits regardless of how long we havebeen in the trade. We have defined a large profit as a profit of 5 averagetrue ranges or more. Once our open profit on a closing basis reaches thislevel we will implement our 2 day low exit regardless of the number of daysin the trade.

The combination of the $2,500 dollar stop, the 25-day lowest low stop, and the switch in exits after 25 days creates a unique exit strategy which leads us to the name for this system.

Conclusion

This report has presented several profitable concepts for trading Bonds,which we believe should be equally applicable in other markets. For example,we have observed that minor variations of this system work well in testingover data in T Notes and Swiss Francs. We have shown the impact of a strongprevailing trend on winning trades and recommend taking long trades onlywhen the trend is clearly and strongly up. In spite of the strong trend wehave also shown that it is more advantageous to wait for a decline in pricesduring the uptrend in order to set up a high-probability entry point. Also,we have shown how a simple adaptation of an age-old exit technique can increaseprofitability and accuracy, while reducing the average holding period pertrade.

We hope that this system as well as all our systems will be profitable in the future. There are no guarantees. Constructing systems that perform well over past data is relatively easy once you learn a few basic rules. But in addition to showing great hypothetical performance, our goal is to develop systems that will serve our club members as valuable learning tools and hopefully produce reasonably good results over the unseen data in the future. Please give us your comments and suggestions about this system and other systems that you would like to see.

Aims of the System Traders Club

First, we do not hope to reveal any "holy grails" to trading. Many of the systems that you will see in the System Club reports include indicators that you may already be familiar with, or that can be easily programmed into the computer. In addition, you will find that many of these systems are not perfect: they will all have drawdowns, and none of them are 100% accurate over the long run. However, we think they deserve serious consideration for actual real-time trading applications. We realize that in the business of trading the futures markets there is no single method that makes money automatically. We believe that a combination of logical system concepts and reasonable entry and exit strategies greatly increases the probability of success in trading. We hope to be able to communicate to you, through these reports, many ofthe concepts that we have learned over the years.

Second, we hope that these reports will serve both an informative as well as a practical purpose. We will share with you lessons that we have accumulated over the years regarding trading strategies and techniques that have worked in various markets, and the logic behind them. You may also want to viewthe systems presented as illustrations of general principles and conceptsin systematic trading of the futures markets. We hope that you may also applythese concepts to your own favorite markets and time-frames. We would welcomeany feedback you may have on possible improvements and different applicationsof these systems.

Third, we intend to provide many different systems and market combinations in our reports. Multiple systems can be combined together in a portfolioto generate more frequent trades and higher returns than any single system.We believe in diversification; but we also realize that diversification isa function of personality and preference. For this reason, we will be offering many different types of systems, from which you will be able to select systems that suit your personality and preference and combine them into your owndiversified trading portfolio.

******************************************************************

MetaStock Efficiency Issues

In order to implement the system several techniques were required that slow performance considerably. Daily commentaries suffer the most. On fast Pentium II processors the delays are bearable, but on a 486 processor it may take 3-5 minutes to update a commentary. System testing with a large data setrequires a lot of patience. If charts are limited to a year’s dailydata (250 bars more or less), delays will be minimized. Commentaries needonly be enabled on setup and actual trade days. Keep open charts to a minimum.

Overview of MetaStock implementation

The 25x25 Bond System enters and exits trades at intraday prices. In order to create a MetaStock 6.50 version it was necessary to develop several indicators to keep track of the intraday entry and exit prices. While this sounds simple enough, MetaStock does not provide global variables or allow circular procedure referencing which would greatly simplify the task.

On top of these shortcomings, MetaStock imposes tremendous processing overhead by not allowing variable assignments within structured code. This means that all values that might be needed in a procedure must be calculated ahead of time, whether required or not, and are constantly updated when referencing previous values.

The 25x25 system only takes long trades. This MetaStock 6.50 system is designed as a template for more complex systems taking both long and short tradesbased on intraday prices and complex entry/exit procedures.

The main indicator is “25x25 LongEntry” which returns the entry price for a trade for each day in the trade. A zero value indicates no position. The exit day is signaled by setting the entry price negative. Thus, the value returned by a single fml(“25x25 LongEntry”) statement tells you the market position, the entry price, and whether it’s the last day of a trade or not, and can be used to calculate a trade’s open profit and days in the trade. This indicator is the heart of the system. It should be carefully studied to understand how it decides when to enter a trade and whether to continue or exit the trade. It stands alone and the other indicators depend on it.

The second indicator is “25x25 LongExit” which returns the exit price when “25x25 LongEntry” returns a negative value. It simply recalculates the exit stop value which triggered a “25x25 LongEntry” negative value. The result is only used to determine a trade’s closed profit. These two indicators may seem redundant for the 25x25 System, but the technique allows for more complex systems that may stop and reverse on intraday prices. By building corresponding “ShortEntry” and “ShortExit” indicators almost any system can be modeled.

A third indicator, “25x25 TP”, returns the Trade Position and all other variables needed by the MetaStock Expert. While not efficient,the Expert allows the system to be traded without the need to plot the indicators.

Since MetaStock’s System Tester does not handle intraday prices, it can’t test the 25x25 performance. The “25x25 Equity” indicator allows the user to plot an equity curve but, unfortunately, a trade by trade report cannot be generated. This indicator is not required by the systemand should only be plotted when testing.

The “25x25 Stop” indicator is another stand alone indicator not required by the system but which is very helpful in seeing the stop values while in a trade. Unlike the other indicators, which should be plotted in separate windows, the “25x25 Stop” can be plotted directly on the daily bar chart. It should be plotted as a dashed line. Note that stop values for days with no trade position are plotted as the days’ low value just to keep the chart properly scaled.

Discrepancies between MetaStock and TradeStation Results

MetaStock and TradeStation do not compute several indicators exactly thesame. In order to duplicate the TradeStation design as closely as possible,the following MetaStock indicators were modified:

Relative Strength Index (RSI(4)) results are rounded to two decimal places with the following code: PREC(RSI(4) + .005, 2)

Average True Range(ATR(45)) smoothing is removed with the following code: Mov(ATR(1), 45, S)

Even with these modifications not all 25x25 trades are exactly matched. However, they are very close. MetaStock’s ten year test equity is $51,556.27 compared to TradeStation’s $53,068.75.

*********************************************************************************

METASTOCK CODE

Chuck Le Beau's System Trader's Clu
mailto:chuck@traderclub.com

"25 x 25" Bond System MetaStock

25X25 LongEntry
{Returns long trade entry price. A non-zero number if in a long trade. Anegative value if the last day of a trade. Note: Modifications to MetaStockindicators were req'd to simulate TradeStation results. RSI: rounded to twodecimal places. ATR: Wilder's smoothing removed }
{Variables to avoid duplicate function calls }
PLLV2 := Ref(LLV(L,2),-1);
PLLV25 := Ref(LLV(L,25),-1);
{ Was yesterday a setup day? }
IsSetUp :=
Cum(1) > 50 AND
Ref(PDI(14),-1) > Ref(MDI(14),-1) AND
Ref(ADX(14),-1) > 20 AND
PREC(Ref(RSI(4),-1)+.005,2) < 50;
{Determine initial entry price condition}
EntryPriceCond := Ref(C,-1) + 0.5625;
{Adjust it to enter on open if open is greater}
EntryPriceCond :=
If(O > EntryPriceCond, O, EntryPriceCond);
{Return entry price, zero if no trade. }
If(PREV <= 0,
{Not in a long trade}
If(IsSetUp AND H >= EntryPriceCond,
{Trade entered today, was it stopped?}
If(L <= PLLV25 OR
L <= EntryPriceCond - 2.5,
-EntryPriceCond, {Yes}
EntryPriceCond {No}
),
{Not in trade and not entered today}
0
),
{Have been in trade for over one day. }
{Was it stopped today? }
{Note: BarsSince() gives days in trade }
If(L <= PREV - 2.5, - PREV,
If(BarsSince(PREV=0) > 24,
{More than 24 days in trade}
If(L <= PLLV2, -PREV, PREV),
{Less than 25 days in trade}
If(L <= PLLV25, -PREV,
If(Ref(C,-1) - PREV >
5*Ref(Mov(ATR(1),45,S),-1),
If(L <= PLLV2, -PREV, PREV),
PREV
)))));

25x25 LongExit
{Returns exit price if last day of long trade}
EntryPrice := Fml("25x25 LongEntry");
ExitingTrade := EntryPrice < 0;
EntryPrice := Abs(EntryPrice);
{Variables to avoid duplicate function calls }
{Lowest low of previous two days }
PLLV2 := Ref(LLV(L,2),-1);
{Lowest low of previous 25 days }
PLLV25 := Ref(LLV(L,25),-1);
TradeDays := If(EntryPrice > 0,
BarsSince(Fml("25x25 LongEntry") = 0), 0);
{ Determine type of stop(s) }
Stop1 :=
ExitingTrade AND TradeDays>24 AND L<=PLLV2;
Stop2 :=
ExitingTrade AND TradeDays>0 AND TradeDays<=24 AND L<=PLLV25;
Stop3 :=
ExitingTrade AND L <= EntryPrice - 2.5;
Stop4 :=
ExitingTrade AND Ref(C,-1) - EntryPrice > 5*Ref(Mov(ATR(1),45,S),-1) AND L <= PLLV2;
{ Determine prices for activated stops }
Stop1Price :=
If(Stop1, Min(O, PLLV2), 0);
Stop2Price :=
If(Stop2, Min(O, PLLV25), 0);
Stop3Price :=
If(Stop3, Min(O, EntryPrice - 2.5), 0);
Stop4Price :=
If(Stop4, Min(O, PLLV2), 0);
{ Assume best stop price stopped the trade }
StopPrice :=
Max(Stop1Price,Max(Stop2Price,
Max(Stop3Price,Stop4Price)));
If(ExitingTrade, StopPrice, 0);​

25x25 TP

{ Calculate today's trade position and other values used by the expert. }

{ LE = LongEntryPrice from indicator }
{ SULE = Tommorow's LongEntry if setup day }
{ SULS = Tommorow's LongStop if setup day }
{ TP = TradePosition +1,0 }
{ TLS = Tomorrow's LongStop if in trade }
{ PRFT = Trade Profit }
{ RISK = Tommorow's theoretical capital risk }


LE := Fml("25x25 LongEntry");
TP := If(LE <> 0, +1, 0);
PRFT := If(LE = 0, 0,
If(LE > 0, C - LE,
Fml("25x25 LongExit") + LE));
TradeDays := If(LE <> 0,
BarsSince(Fml("25x25 LongEntry") = 0), 0);

{Calculate tomorrow's entry prices }
SULE :=
If(TP = 0,
If(PDI(14) > MDI(14) AND ADX(14) > 20 AND
PREC(RSI(4)+.005,2) < 50,
C + .5625, 0), 0);

{Calculate initial stop price}
SULS :=
If(SULE <> 0, Max(LLV(L,25), SULE-2.5), 0);

{Calculate tomorrow's stops }
S1 := If(LE > 0,
If(TradeDays >= 24,
LLV(L,2),
LLV(L,25)), 0);
S2 := If(LE > 0, LE - 2.5, 0);
S3 := If(LE > 0 AND
PRFT >= 5*Ref(Mov(ATR(1),45,S),-1),
LLV(L,2), 0);

{Tomorrow's Long Stop}
TLS := Max(S1, Max(S2, S3));

PRFT := PRFT * 1000;

RISK :=
If(LE > 0, (LE-TLS)*1000,
If(SULE <> 0, (SULE-SULS)*1000, 0));

TP;


****************************************************************************************
The following Trade by Trade Report was produced using the data suppliedwith this archive
which is continuous contract, back-adjusted, day session only, Bond futures data.

Bond "25" System UA.LNG-Daily 01/04/88 - 01/16/98

Date Time Type Cnts Price Signal Name Entry P/L Cumulative

06/22/88 Buy 1 64^10
07/13/88 LExit 1 62^22 L25 $ -1725.00 $ -1725.00
09/29/88 Buy 1 64^24
11/04/88 LExit 1 67^10 $ 2462.50 $ 737.50
05/05/89 Buy 1 67^23
06/15/89 LExit 1 73^13 $ 5587.50 $ 6325.00
06/20/89 Buy 1 73^14
08/03/89 LExit 1 77^21 $ 4118.75 $ 10443.75
08/15/89 Buy 1 74^12
08/22/89 LExit 1 73^24 L25 $ -725.00 $ 9718.75
08/23/89 Buy 1 74^08
08/29/89 LExit 1 73^17 L25 $ -818.75 $ 8900.00
10/19/89 Buy 1 76^14
11/27/89 LExit 1 77^01 $ 493.75 $9393.75
06/26/90 Buy 1 71^13
07/10/90 LExit 1 70^27 L25 $ -662.50 $ 8731.25
11/09/90 Buy 1 70^14
12/17/90 LExit 1 74^23 $ 4181.25 $ 12912.50
08/28/91 Buy 1 77^31
10/03/91 LExit 1 80^22 $ 2618.75 $ 15531.25
11/06/91 Buy 1 80^05
12/13/91 LExit 1 82^05 $ 1900.00 $ 17431.25
01/17/92 Buy 1 84^16
01/29/92 LExit 1 83^07 L25 $ -1381.25 $ 16050.00
05/29/92 Buy 1 83^25
07/08/92 LExit 1 86^13 $ 2525.00 $ 18575.00
07/15/92 Buy 1 86^17
08/21/92 LExit 1 89^22 $ 3056.25 $ 21631.25
12/29/92 Buy 1 91^18
02/10/93 LExit 1 93^31 $ 2306.25 $ 23937.50
02/11/93 Buy 1 93^31
03/22/93 LExit 1 97^17 $ 3462.50 $ 27400.00
08/09/93 Buy 1 104^20
09/15/93 LExit 1 108^25 $ 4056.25 $ 31456.25
12/13/94 Buy 1 94^05
01/20/95 LExit 1 94^15 $ 212.50 $31668.75
02/10/95 Buy 1 97^04
03/21/95 LExit 1 99^06 $ 1962.50 $ 33631.25
03/24/95 Buy 1 99^02
05/11/95 LExit 1 104^04 $ 4962.50 $ 38593.75
06/13/95 Buy 1 108^18
07/19/95 LExit 1 107^31 $ -693.75 $ 37900.00
09/19/95 Buy 1 110^13
10/27/95 LExit 1 112^05 $ 1650.00 $ 39550.00
10/27/95 Buy 1 112^31
12/07/95 LExit 1 116^16 $ 3431.25 $ 42981.25
08/16/96 Buy 1 108^22
08/26/96 LExit 1 106^06MM $ -2600.00 $ 40381.25
10/11/96 Buy 1 108^17
11/25/96 LExit 1 113^02 $ 4431.25 $ 44812.50
05/08/97 Buy 1 108^21
06/18/97 LExit 1 110^22 $ 1931.25 $ 46743.75
06/27/97 Buy 1 110^28
08/04/97 LExit 1 113^28 $ 2900.00 $ 49643.75
09/26/97 Buy 1 115^14
11/03/97 LExit 1 117^05 $ 1618.75 $ 51262.50
11/06/97 Buy 1 117^15
12/17/97 LExit 1 119^12 $ 1806.25 $ 53068.75
12/31/97 Buy 1 120^05

To view an equity chart based on the above trades go to:


PAST PERFORMANCE IS NOT NECESSARILY INDICATIVE OF FUTURE RESULTS.

HYPOTHETICAL OR SIMULATED PERFORMANCE RESULTS HAVE CERTAIN INHERENT LIMITATIONS. UNLIKE AN ACTUAL PERFORMANCE RECORD, SIMULATED RESULTS DO NOT REPRESENT ACTUAL TRADING. ALSO, SINCE THE TRADES HAVE NOT ACTUALLY BEEN EXECUTED, THE RESULTS MAY HAVE UNDER-OR-OVER COMPENSATED FOR THE IMPACT, IF ANY, OF CERTAIN MARKET FACTORS SUCH AS LACK OF LIQUIDITY. SIMULATED TRADING PROGRAMS IN GENERALARE ALSO SUBJECT TO THE FACT THAT THEY ARE DESIGNED WITH THE BENEFIT OF HINDSIGHT. NO REPRESENTATION IS BEING MADE THAT ANY ACCOUNT WILL OR IS LIKELY TO ACHIEVE PROFITS OR LOSSES SIMILAR TO THOSE SHOWN.




Są to kryteria wejścia/wyjścia jak i wskaźniki które trzeba stworzyć w module "Indicator Builder".
Formuła 25x25 TP ..........


25x25 LongEntry

PLLV2 := Ref(LLV(L,2),-1);
PLLV25 := Ref(LLV(L,25),-1);

IsSetUp :=
Cum(1) > 50 AND
Ref(PDI(14),-1) > Ref(MDI(14),-1) AND
Ref(ADX(14),-1) > 20 AND
PREC(Ref(RSI(4),-1)+.005,2) < 50;

EntryPriceCond := Ref(C,-1) + 0.5625;
EntryPriceCond := If(O > EntryPriceCond, O, EntryPriceCond);

If(PREV <= 0,
If(IsSetUp AND H >= EntryPriceCond,
If(L <= PLLV25 OR
L <= EntryPriceCond - 2.5,
-EntryPriceCond, {Yes}
EntryPriceCond {No}
),
0
),
If(L <= PREV - 2.5, - PREV,
If(BarsSince(PREV=0) > 24,
If(L <= PLLV2, -PREV, PREV),
If(L <= PLLV25, -PREV,
If(Ref(C,-1) - PREV >
5*Ref(Mov(ATR(1),45,S),-1),
If(L <= PLLV2, -PREV, PREV),
PREV
)))));



25x25 LongExit

EntryPrice := Fml("25x25 LongEntry");
ExitingTrade := EntryPrice < 0;

EntryPrice := Abs(EntryPrice);

PLLV2 := Ref(LLV(L,2),-1);
PLLV25 := Ref(LLV(L,25),-1);
TradeDays := If(EntryPrice > 0,
BarsSince(Fml("25x25 LongEntry") = 0), 0);

Stop1 :=
ExitingTrade AND TradeDays>24 AND L<=PLLV2;
Stop2 :=
ExitingTrade AND TradeDays>0 AND TradeDays<=24 AND L<=PLLV25;
Stop3 :=
ExitingTrade AND L <= EntryPrice - 2.5;
Stop4 :=
ExitingTrade AND Ref(C,-1) - EntryPrice > 5*Ref(Mov(ATR(1),45,S),-1) AND L <= PLLV2;

Stop1Price :=
If(Stop1, Min(O, PLLV2), 0);
Stop2Price :=
If(Stop2, Min(O, PLLV25), 0);
Stop3Price :=
If(Stop3, Min(O, EntryPrice - 2.5), 0);
Stop4Price :=
If(Stop4, Min(O, PLLV2), 0);

StopPrice :=
Max(Stop1Price,Max(Stop2Price,
Max(Stop3Price,Stop4Price)));

If(ExitingTrade, StopPrice, 0);
Source / From:
 

Forumdan daha fazla yararlanmak için giriş yapın yada üye olun!

Forumdan daha fazla yararlanmak için giriş yapın veya kayıt olun!

Kayıt ol

Forumda bir hesap oluşturmak tamamen ücretsizdir.

Şimdi kayıt ol
Giriş yap

Eğer bir hesabınız var ise lütfen giriş yapın

Giriş yap