Self Optimizing RSI or MFI Trader - Expert for MetaTrader 4



เป็นความฝันของใครหลายๆคนที่จะมี EA ดีๆซักตัวที่ปรับค่าให้เหมาะกับตัวเราเอง

นี่คือความพยายามของผมที่จะนำความฝันของทุกคนไปสู่ความเป็นจริง คนที่เก่งอยู่แล้วหรือคนอื่นๆสามารถมาช่วยพัฒนาเพิ่มระดับการซื้อขายให้ดีขึ้นในการเทรดได้

เป็นความปรารถนาของผม ที่คนอื่นอาจใช้แนวคิดนี้และต่อยอดเพื่อสร้างสิ่งที่ยิ่งใหญ่กว่านี้




กลยุทธ์นี้ใช้ได้กับคู่สกุลเงินใด ๆ ที่ใช้กรอบเวลาใด ๆ กับการตั้งค่าที่ถูกต้อง

มีอินพุตไม่กี่รายการสำหรับหุ่นยนต์ตัวนี้ ผมได้รวมคุณลักษณะพิเศษเป็นค่าโรงงานสามารถปรับได้


Inputs

  • magic = 4376 - Unique number for this EA.
  • optomizingPeriods = 144 - Optimization periods (bars). This is the number of bars you would like the optimization to run on. For example, if you are using an hourly chart and you choose 144, the robot will look back 144 hours which equates to six days.
  • inAggressive = false - Make expert aggressive? Risky. Aggressive mode will cause the expert advisor to take trades in a more aggressive manner. Instead of waiting for a cross of the overbought or oversold level in the aggressive mode the robot will take a buy trade simply if the buys have been more profitable than the sells lately and vice versa.
  • inTradeReverse = false - Reverse trading. Reverse trading will switch the direction of your trades.
  • inOneOrderAtATime = true - Only one order open at a time?. If true the robot will only have one order at a time, if false it will open unlimited amounts of order according to entry conditions.
  • Lot_sizing_dynamic_invalidates_static - Simply a spacer to separate Lot sizing mechanics from the other inputs.
  • Lots = 0.01 - Static Lot size of orders. Specify the lot size for your orders using a static number.
  • inUseDynamicLotSize = true - Use Dynamic lot sizing. Turns on dynamic lot sizing which would be used instead of static lot sizing, However, if the dynamic lots size proves to be invalid the robot will default to the static lot size.
  • inPercentageOfRisk = 2 - Balance % to risk on each trade (2 = 2%). When using dynamic lot sizing you specify your lot size as a percentage of your balance. 2 is equal to 2 percent. No need to enter 0.02 if you do enter it in that way the percentage used would be very small indeed. The maximum percentage that can be used is 10 percent.
  • Index_Indicator_Values - Simply a spacer to separate index indicator parameters from other inputs.
  • indicator index = _RSI_ - Choose which index indicator to use. Allow you to choose which indicator you would like to use current choices are Relative Strength Index (RSI) or Money Flow Index (MFI).
  • IndicatorTopValue = 100 - Top most value you would trade at. This the uppermost value you would place a trade at using your indicator. Leave it at 100 to consider all the index indicator values.
  • IndicatorBottomValue = 0 - Bottom most value you would trade at. This is the bottom-most value you would place a trade at using your indicator. Leave it at 0 to consider all the index indicator values.
  • IndyTimeframe = PERIOD_CURRENT - Timeframe for index. Select which time frame you would like to use for the indicator during optimization and trading. PERIOD_CURRENT simply means that it would use the time frame of the chart that you attach the expert advisor to. You could theoretically use a time frame for your calculations that is different from the chart you attach the robot to if you wish to do so here is where you would change that setting.
  • inIndyPeriods = 14 - Averaging period for index and ATR calculations. Average True Range (ATR) is used in setting a dynamic stop-loss or take-profit in further input options below.
  • IndyAppPrice = PRICE_CLOSE - Applied price for index if needed.
  • SL_TP_Dynamic_invalidates_static_values - Simply a spacer to separate stop loss and take profit parameters from other inputs.
  • iStoploss = 1000 - Static Stoploss value in points. Stop loss values are in points which is the smallest unit of movement in your terminal.
  • iTakeprofit = 2000 - Static Takeprofit value in points. Take profit values are in powhich is the smallest unit of movement in your terminal.
  • input inDynamic = true - Use Dynamic sp & tp based on ATR multiple? If you turn on the dynamic stop loss and take profit they will be used instead of the static stop loss or take profit. Dynamic settings can be attractive because they have the ability to adjust according to market behavior. Since the ATR is larger when there is more movement, using dynamic would result in larger stop losses and take profits when the market is moving fast and closer settings when the market has slowed down.
  • inStoplossMultiple = 2 - Dynamic SL = X * ATR (Averaging Period). The stop loss will be the value you place here multiplied by the Average True Range (ATR) using the periods specified in the inIndyPeriods - input setting.
  • inTakeProfitMultiple = 7 - Dynamic TP = X * ATR (Averaging Period). The take profit will be the value you place here multiplied by the Average True Range (ATR) using the periods specified in the inIndyPeriods - input setting.
  • Break_Even_Settings - Padding must be lower than Trigger. A separator for Break even settings. The way it works is when points in profits go above the trigger amount the stop loss is moved to break even. If you have a padding setting then the stop loss is moved to break even + padding to lock in the padding amount of profit.
  • bUseBreakEven = true - Use Break Even (BE). Turn the use of break even on or off.
  • inTrigger = 200 - If BE = [true] set Points in profit to trigger. If the trade gets to these many points in profit the stop loss will be moved to break even.
  • inPadding = 100 - Padding points to add to BE must be lower than trigger. This is a number of points of profit you want to lock in when moving to break even, this amount must be less than the trigger.
EA ตัวนี้ดีที่สุด? ไม่มี EA ไหนดีสุดหรอกครับ เพราะเราต้องทดสอบแต่ละตัวแปรในดัชนีหลายๆครั้ง
ดังนั้นหากอินดี้มีค่าที่เป็นไปได้หนึ่งร้อยรายการแต่ละค่าจะต้องใช้ค่าต่างๆและพยายามทำการเทรดที่ค่าดังกล่าวซึ่งจะย้อนกลับไปที่บาร์จำนวนหนึ่ง (optomizingPeriods) จากนั้นมันจะประมวลผลด้วยเงินที่เรามี จะได้กำไรหรือแพ้ขาดทุน โดยการซื้อขายนี้ขึ้นอยู่กับบิตที่ซับซ้อนกว่า
Givens เมื่ออินดี้ข้ามค่าซื้อจากด้านบนใบสั่งขายจะออกคำสั่งซื้อจะออกเมื่อตัวบ่งชี้ข้ามจากด้านล่างเป็นค่าเฉลี่ยที่สูงกว่ามูลค่า oversold ตัวอย่างเช่นถ้าซื้อเกินกำหนดไว้ที่ 80 และค่าของอินดี้ RSIเท่ากับ 85 ในแถบก่อนหน้าสุดท้ายและค่าของอินดี้ที่แถบสุดท้ายเท่ากับ 79 จะมีการออกคำสั่งที่ 85 → 79 ข้าม 80 ลงไปสั่งขายออก ถ้า oversold = 23 แล้ว 19 → 27 ขึ้นไปจะสร้างคำสั่งซื้อ
ดังนั้น EA ตัวนี้จะใช้ค่าสำหรับตัวบ่งชี้จาก IndicatorTopValue และ IndicatorBottomValue ทุกค่า - และรันการทดสอบโดยเฉพาะการทดสอบสองชุด ดำเนินการทดสอบซื้อและขายในแต่ละค่า ตัวอย่างเช่น ถ้าค่าสูงสุดเป็น 100 จะใช้เวลาเป็นค่าสูงสุดและย้อนกลับไปที่ช่วงการปรับขนาดเวลาสมมติว่าเป็นระยะเวลา 144 ดังนั้นจะเห็นได้ว่าการซื้อที่ 100 และการขายที่ 100 จะทำกำไรได้ในช่วง 144 งวดล่าสุด หากมีผลกำไรจะเก็บเงินจำนวนนั้นไว้
พิจารณาระยะเวลาที่คุณกลับมาทดสอบแล้วอาจมีโอกาสได้ซื้อหลายครั้งในระหว่างการทำ backtest ถ้ามันตีกำไรก่อนที่จะหยุดการสูญเสียก็จะมีผลกำไร ถ้ามันฮิตหยุดการสูญเสียก่อนที่จะทำกำไรมันมีผลลบ หลังจากการทดสอบช่วงเวลาทั้งหมดในช่วงเวลาที่กำหนดไว้ - จะเพิ่มผลกำไรทั้งหมดที่เกิดจากการสูญเสียทั้งหมดเพื่อรักษามูลค่าทางการเงินไว้ จากนั้นตัวบ่งชี้จะเลื่อนไปสู่ค่าตัวบ่งชี้ที่ต่ำกว่าถัดไปและทดสอบเพื่อหากำไร
เมื่อมีการทดสอบค่าทั้งหมดจะเป็นการเลือกมูลค่าที่มีจำนวนเงินสูงสุดและเลือกเป็นมูลค่าซื้อที่ดีที่สุด จากนั้นจะดำเนินการตรวจสอบราคาขายที่คล้ายกัน เมื่อเสร็จสิ้นแล้วจะเปรียบเทียบค่าซื้อที่ดีที่สุดกับมูลค่าขายที่ดีที่สุดและมองหาการค้าที่ดีที่สุดเท่าที่จะเป็นไปได้ 


 ตัวอย่างเช่น หลังจากที่ใช้การเพิ่มประสิทธิภาพนี้จะกำหนดว่าการซื้อที่ดีที่สุดจะอยู่ที่ 65 เนื่องจากการซื้อที่ 65 สร้างกำไรมากที่สุดสำหรับการซื้อ $ 329 ใน backtesting มันจะตรวจสอบค่าที่ได้สำหรับการขายที่ดีที่สุดและถ้าขายดีที่สุดคือ 32 ที่มีกำไร 530 เหรียญ EA จะมองหาการเทรดโดยมีตัวบ่งชี้ที่ข้ามระดับ 32 เนื่องจากขายได้ดีกว่าการซื้อตามผลกำไรที่เกิดขึ้นในการทดสอบ

The Future Expansion Ideas

  • Trade multiple currency pairs at the same time, possibly filtered by spread size.
  • Self-learning, whereby it learns from its own trades what is best.
  • Backtesting could also include a forward testing component.
  • More indicators to choose from.

ความคิดเห็น

เรื่องราวที่น่าสนใจ