OPEN-SOURCE SCRIPT
Mean Reversion at or under 200MA

This strategy is based on the 30 minute of the S&P futures chart, MES
A Long Buy will be executed if, the EMA 9 or price comes down to or under the 200 MA, AND THEN the slope of the ema 9 subsequently changes from negative to positive.
The buy will be executed either; at a retest of the local lows (defined by the lowest wick between the most recent red candle that is subsequently followed by a green candle) (a retest is defined as 70% retrace from the local highs (inversely defined from local lows) to the local lows), or if a retest of the lows fails to occur, a market order will be executed at the local highs.
With a fixed position size of 10 contracts, the take profits will be established as such; 2 contracts sold up 6 points of profit, the next two will be sold up 10 points of profit, and the remaining 2 contracts will be sold for 20 points of profit. As soon as the first trim is made, a stop loss is placed at break even. Further, as soon as the second trim is made, the stop loss will be moved to +5 profit points.
In the instance that the ema 9 returns to downward sloping, stop orders will be executed. This will trigger sells either at local lows or local highs.
Kind of just made this for a class project, but the logic is sound, and the results are formidable thus far - enjoy :)
A Long Buy will be executed if, the EMA 9 or price comes down to or under the 200 MA, AND THEN the slope of the ema 9 subsequently changes from negative to positive.
The buy will be executed either; at a retest of the local lows (defined by the lowest wick between the most recent red candle that is subsequently followed by a green candle) (a retest is defined as 70% retrace from the local highs (inversely defined from local lows) to the local lows), or if a retest of the lows fails to occur, a market order will be executed at the local highs.
With a fixed position size of 10 contracts, the take profits will be established as such; 2 contracts sold up 6 points of profit, the next two will be sold up 10 points of profit, and the remaining 2 contracts will be sold for 20 points of profit. As soon as the first trim is made, a stop loss is placed at break even. Further, as soon as the second trim is made, the stop loss will be moved to +5 profit points.
In the instance that the ema 9 returns to downward sloping, stop orders will be executed. This will trigger sells either at local lows or local highs.
Kind of just made this for a class project, but the logic is sound, and the results are formidable thus far - enjoy :)
สคริปต์โอเพนซอร์ซ
ด้วยเจตนารมณ์หลักของ TradingView ผู้สร้างสคริปต์นี้ได้ทำให้เป็นโอเพนซอร์ส เพื่อให้เทรดเดอร์สามารถตรวจสอบและยืนยันฟังก์ชันการทำงานของมันได้ ขอชื่นชมผู้เขียน! แม้ว่าคุณจะใช้งานได้ฟรี แต่โปรดจำไว้ว่าการเผยแพร่โค้ดซ้ำจะต้องเป็นไปตาม กฎระเบียบการใช้งาน ของเรา
คำจำกัดสิทธิ์ความรับผิดชอบ
ข้อมูลและบทความไม่ได้มีวัตถุประสงค์เพื่อก่อให้เกิดกิจกรรมทางการเงิน, การลงทุน, การซื้อขาย, ข้อเสนอแนะ หรือคำแนะนำประเภทอื่น ๆ ที่ให้หรือรับรองโดย TradingView อ่านเพิ่มเติมใน ข้อกำหนดการใช้งาน
สคริปต์โอเพนซอร์ซ
ด้วยเจตนารมณ์หลักของ TradingView ผู้สร้างสคริปต์นี้ได้ทำให้เป็นโอเพนซอร์ส เพื่อให้เทรดเดอร์สามารถตรวจสอบและยืนยันฟังก์ชันการทำงานของมันได้ ขอชื่นชมผู้เขียน! แม้ว่าคุณจะใช้งานได้ฟรี แต่โปรดจำไว้ว่าการเผยแพร่โค้ดซ้ำจะต้องเป็นไปตาม กฎระเบียบการใช้งาน ของเรา
คำจำกัดสิทธิ์ความรับผิดชอบ
ข้อมูลและบทความไม่ได้มีวัตถุประสงค์เพื่อก่อให้เกิดกิจกรรมทางการเงิน, การลงทุน, การซื้อขาย, ข้อเสนอแนะ หรือคำแนะนำประเภทอื่น ๆ ที่ให้หรือรับรองโดย TradingView อ่านเพิ่มเติมใน ข้อกำหนดการใช้งาน