Hans123 Forex Converter

3.3 How to implement strategies in M language

3.3 How to implement strategies in M language


In the previous article, we explained the premise of realizing the trading strategy from the aspects of the introduction of the M language , the basic grammar, the model execution method, and the model classification. In this article, we will continue the previous part, from the commonly used strategy modules and technologies. Indicators, step by step to help you achieve a viable intraday quantitative trading strategy.

Strategy Module


Stage Increase

Stage increase is calculating the percentage of current K line's closing price compare with previous N periods of closing price's difference. For example: Computing the latest 10 K-lines stage increases, can be written:
CLOSE_0:=CLOSE; //get the current K-line's closing price, and save the results to variable CLOSE_0. CLOSE_10:=REF(CLOSE,10); //get the pervious 10 K-lines' closing price, and save the results to variable CLOSE_10 (CLOSE_0-CLOSE_10)/CLOSE_10*100;//calculating the percentage of current K line's closing price compare with previous N periods of closing price's difference. 

New high price

The new high price is calculated by whether the current K line is greater than N cycles' highest price. For example: calculating whether the current K line is greater than the latest 10 K-lines' highest price, can be written:
HHV_10:=HHV(HIGH,10); //Get the highest price of latest 10 K-lines, which includes the current K-line. HIGH>REF(HHV_10,1); //Judge whether the current K-line's highest price is greater than pervious K-lines' HHV_10 value. 

Price raise with massive trading volume increase

For example: If the current K line's closing price is 1.5 times of the closing price of the previous 10 K-lines, which means in 10 days, the price has risen 50%; and the trading volume also increased more than 5 times of the pervious 10 K-lines. can be written:
CLOSE_10:=REF(CLOSE,10); //get the 10th K-line closing price IS_CLOSE:=CLOSE/CLOSE_10>1.5; //Judging whether the current K Line closing price is 1.5 times greater than the value of CLOSE_10 VOL_MA_10:=MA(VOL,10); //get the latest 10 K-lines' average trading volume IS_VOL:=VOL>VOL_MA_10*5; //Judging whether the current K-line's trading volume is 5 times greater than the value of VOL_MA_10 IS_CLOSE AND IS_VOL; //Judging whether the condition of IS_CLOSE and IS_VOL are both true. 

Price narrow-shock market

Narrow-shock market means that the price is maintained within a certain range in the recent period. For example: If the highest price in 10 cycles minus the lowest price in 10 cycles, the result divided by the current K-line's closing price is less than 0.05. can be written:
HHV_10:=HHV(CLOSE,10); //Get the highest price in 10 cycles(including current K-line) LLV_10:=LLV(CLOSE,10); //Get the lowest price in 10 cycles(including current K-line) (HHV_10-LLV_10)/CLOSE<0.05; //Judging whether the difference between HHV_10 and LLV_10 divided by current k-line's closing price is less than 0.05. 

Moving average indicates bull market

Moving Average indicates long and short direction, K line supported by or resisted by 5,10,20,30,60 moving average line, Moving average indicates bull market or bear market. can be written:
MA_5:=MA(CLOSE,5); //get the moving average of 5 cycle closing price. MA_10:=MA(CLOSE,10);//get the moving average of 10 cycle closing price. MA_20:=MA(CLOSE,20);//get the moving average of 20 cycle closing price. MA_30:=MA(CLOSE,30);//get the moving average of 30 cycle closing price. MA_5>MA_10 AND MA_10>MA_20 AND MA_20>MA_30; //determine wether the MA_5 is greater than MA_10, and MA_10 is greater than MA_20, and MA_20 is greater than MA_30. 

Previous high price and its locations

To obtain the location of the previous high price and its location, you can use FMZ Quant API directly. can be written:
HHV_20:=HHV(HIGH,20); //get the highest price of 20 cycle(including current K line) HHVBARS_20:=HHVBARS(HIGH,20); //get the number of cycles from the highest price in 20 cycles to current K line HHV_60_40:REF(HHV_20,40); //get the highest price between 60 cycles and 40 cycles. 

Price gap jumping

The price gap is the case where the highest and lowest prices of the two K lines are not connected. It consists of two K lines, and the price gap is the reference price of the support and pressure points in the future price movement. When a price gap occurs, it can be assumed that an acceleration along the trend with original direction has begun. can be written:
HHV_1:=REF(H,1); //get the pervious K line's highest price LLV_1:=REF(L,1); //get the pervious K line's lowest price HH:=L>HHV_1; //judging wether the current K line's lowest price is greater than pervious K line's highest price (jump up) LL:=H1.001; //adding additional condition, the bigger of the price gap, the stronger the signal (jump up) LLL:=H/REF(L.1)<0.999; //adding additional condition, the bigger of the price gap, the stronger the signal (jump down) JUMP_UP:HH AND HHH; //judging the overall condition, whether it is a jump up JUMP_DOWN:LL AND LLL; //judging the overall condition, whether it is a jump down 

Common technical indicators

Moving average

From a statistical point of view, the moving average is the arithmetic average of the daily price, which is a trending price trajectory. The moving average system is a common technical tool used by most analysts. From a technical point of view, it is a factor that affects the psychological price of technical analysts. The decision-making factor of thinking trading is a good reference tool for technical analysts. The FMZ Quant tool supports many different types of moving averages, as shown below:
MA_DEMO:MA(CLOSE,5); // get the moving average of 5 cycle MA_DEMO:EMA(CLOSE,15); // get the smooth moving average of 15 cycle MA_DEMO:EMA2(CLOSE,10);// get the linear weighted moving average of 10 cycle MA_DEMO:EMAWH(CLOSE,50); // get the exponentially weighted moving average of 50 cycle MA_DEMO:DMA(CLOSE,100); // get the dynamic moving average of 100 cycle MA_DEMO:SMA(CLOSE,10,3); // get the fixed weight of 3 moving average of closing price in 10 cycle MA_DEMO:ADMA(CLOSE,9,2,30); // get the fast-line 2 and slow-line 30 Kaufman moving average of closing price in 9 cycle. 

Bollinger Bands

Bollinger bands is also based on the statistical principle. The middle rail is calculated according to the N-day moving average, and the upper and lower rails are calculated according to the standard deviation. When the BOLL channel starts changing from wide to narrow, which means the price will gradually returns to the mean. When the BOLL channel is changing from narrow to wide, it means that the market will start to change. If the price is up cross the upper rail, it means that the buying power is enhanced. If the price down cross the lower rail, it indicates that the selling power is enhanced.
Among all the technical indicators, Bollinger Bands calculation method is one of the most complicated, which introduces the concept of standard deviation in statistics, involving the middle trajectory ( MB ), the upper trajectory ( UP ) and the lower trajectory ( DN ). luckily, you don't have to know the calculation details, you can use it directly on FMZ Quant platform as follows:
MID:MA(CLOSE,100); //calculating moving average of 100 cycle, call it Bollinger Bands middle trajectory TMP2:=STD(CLOSE,100); //calculating standard deviation of closing price of 100 cycle. TOP:MID+2*TMP2; //calculating middle trajectory plus 2 times of standard deviation, call it upper trajectory BOTTOM:MID-2*TMP2; //calculating middle trajectory plus 2 times of standard deviation, call it lower trajectory 

MACD Indicator

The MACD indicator is a double smoothing operation using fast (short-term) and slow (long-term) moving averages and their aggregation and separation. The MACD developed according to the principle of moving averages removes the defect that the moving average frequently emits false signals, and also retains the effect of the other good aspect. Therefore, the MACD indicator has the trend and stability of the moving average. It was used to study the timing of buying and selling stocks and predicts stock price change. You can use it as follows:

DIFF:EMA(CLOSE,10)-EMA(CLOSE,50); //First calculating the difference between short-term moving average and long-term moving average. DEA:EMA(DIFF,10); //Then calculating average of the difference. 
The above is the commonly used strategy module in the development of quantitative trading strategies. In addition, there are far more than that. Through the above module examples, you can also implement several trading modules that you use most frequently in subjective trading. The methods are the same. Next, we began to write a viable intraday trading strategy.

Strategy Writing

In the Forex spot market, there is a wellknown strategy called HANS123. Its logic are basically judging wether the price breaks through the highest or lowest price of the number of K lines after the market opening

Strategy logic

  • Ready to enter the market after 30 minutes of opening;
  • Upper rail = 30 minutes high after opening ;
  • Lower rail = 30 minutes low after opening ;
  • When the price breaks above the upper limit, buy and open the position;
  • When the price falls below the lower rail, the seller opens the position.
  • Intraday trading strategy, closing before closing;

Strategy code

// Data Calculation Q:=BARSLAST(DATA<>REF(DATA,1))+1; //Calculating the number of period from the first K line of the current trading day to current k line, and assign the results to N HH:=VALUEWHEN(TIME=0930,HHV(H,Q)); //when time is 9:30, get the highest price of N cycles, and assign the results to HH LL:=VALUEWHEN(TIME=0930,LLV(L,Q)); //When time is 9:30, get the lowest price of N cycles, and assign the results to LL //Placing Orders TIME>0930 AND TIME<1445 AND C>HH,BK; //If the time is greater than 9:30 and lesser than 14:45, and the closing price is greater than HH, opening long position. TIME>0930 AND TIME<1445 AND C=1445,CLOSEOUT; //If the time is greater or equal to 14:45, close all position. //Filtering the signals AUTOFILTER; //opening the filtering the signals mechanism 

To sum up

Above we have learned the concept of the strategy module. Through several commonly used strategy module cases, we had a general idea of the FMZ Quant programming tools, it can be said that learning to write strategy modules and improve programming logic thinking is a key step in advanced quantitative trading. Finally, we used the FMZ Quant tool to implement the trading strategy according a classical Forex trading strategy.

Next section notice

Maybe there are still some confusion for some people, mainly because of the coding part. Don't worry, we have already thought of that for you. On the FMZ Quant platform, there is another even easier programming tool for beginners. It is the visual programming, let's learn it soon!
submitted by FmzQuant to CryptoCurrencyTrading [link] [comments]

Take Profit EA Best EA MT4 Swinging at fat pitches—global macro trader, Dario Mofardin Thinda USD calms down ahead of first-tier data (05.12.2017) U.S. Provoking Currency Wars? (Market Moving News This Week)

Tuesday, 13 December 2016. Hans123 Forex Converter The strategy works best with the British pound/U.S. dollar (GBP/USD) rate.Because this currency rate trades lightly outside of London trading hours, the surge in trading every morning in the U.K. gives it a “real” market opening, which the strategy looks to exploit. Figure 1 shows pound/dollar trading is virtually nonexistent during Asian trading hours. Hello, I appreciate all the great stuff that's posted in the Indicators thread, and I was looking to test some for my VT trader. However I found this "Hans123 Simple Combined Breakout System" indicator listed, but I couldn't find any details or description regarding it.If you please explain to me the concept of the system, I see some buy / sell arrows and some labeled exits but I do not know ... Can somebody help me to get the Amibroker code for Hans 123 breakout system. It´s enough with the code that draws the lines, alerts not neccessary At 24.00 CET all orders expiring and close all trades at market. On Friday we do the same at 23.00 CET. On Friday we do the same at 23.00 CET. you do wait till 10 am and set the Orders according to the values and then to 2 pm and do the same. I use it on the 15 min time frame. I use TD points to make up the 123 pattern. I look for long trades when the market is going short and short trades when the market is moving up. I take the trade 1 pip of the high/low of the 2. I trail the stop as the market moves up/down. Let me know if you are interested in hearing more about it. Submit by joy22. Time Frame: 15, 30, 60 min. Pairs:Eur/USD, GBP/USD Long Entry. Buy when price crosses up red dot (resistance).There can be two trades in a single day, because there're two string of red dots. Abe Cofnas - The Forex Trading Course (2008 Version) (learn4x.com) ... Daniel Pinto - Automated Trading in the Forex Market – 11.01.2017 10:14:19: Daniel Strachman - Essential Stock Picking Strategies What Works on Wall Street – 11.01.2017 10:14:19: Dara Duguay - Don't Spend Your Raise – 11.01.2017 10:14:19: Darrell Jobman - The Handbook of Alternative Investments – 11.01.2017 10:14:19 ... Forex. oilfxpro Well-known member. 409 9. Mar 12, 2008 #1 Hi folks I am posting this system here hoping many of u will suggest improvements to this system.It is a profitable if used as part of a portfolio of strategies.Most people have misused it by overleverage , and blown their accounts.If there are improvements I will post them on the orignal thread at Strategy builder FX and hopfully we ... Hans 123 is a forex trading system that any forex trading website should have in its database, hence this post today. Whilst I can not say it has been a system I have used it definitely sparked some breakout trading ideas which have helped me over the years. This system was popular about 4/5 years ago but since then it has not been discussed as much as it used to.

[index] [2562] [22596] [8522] [679] [26749] [26841] [29808] [5787] [16866] [2488]

Take Profit EA

Warren Buffett reveals his investment strategy and mastering the market - Duration: 59:30. Yahoo Finance 1,529,981 views. 59:30 . 5 Lessons From the WORST Trading Indicator We Built - Duration: 14 ... 95% Winning Forex Trading Formula - Beat The Market Maker📈 - Duration: 37:53. TRADE ATS Recommended for you. 37:53. Building Your Brain for Success with Legendary Neuroscientist V.S ... Take profit ea, MT4 EA, Expert Advisor, MetaTrader 4, TOP SECRET EA, The Best forex EA, Best forex EA, Best EA, Take Profit, Take Profit ea, Expert Advisors, TakeProfit, TakeProfitEA, MT4 FOREX ... 2-bo'lim, 8-dars (12) Navbatdagi darsimizda "events" moduli bilan tanishamiz. EP 092: Observing the whole board, building a body of evidence, swinging at fat pitches w/ Dario Mofardin Dario Mofardin went from a finance degree, straight into a market analyst and then trader ... Take profit ea, MT4 EA, Expert Advisor, MetaTrader 4, TOP SECRET EA, The Best forex EA, Best forex EA, Best EA, Take Profit, Take Profit ea, Expert Advisors, TakeProfit, TakeProfitEA, MT4 FOREX ... The US dollar index dipped for a while as market participants are weary, awaiting the next stage of the US tax reform saga. The dollar/yen pair retreated from 113.00 and is making correctional moves.