Seçilen sembol için düşen formasyon onaylandığında açığa satış yapacak ve (yarı hedef fiyatı-onaylanma fiyatı)/onaylanma fiyatı*100 oranında kar al ve zarar durdur eklenecek.
Strateji açığa sat ile başlayıp sıralı ilerleyecektir.
*** Düşen formasyon listesinde istenmeyen formasyonların index numarası silinebilir.
List<int> dusenFormasyon = new List<int>()
{
1, 3, 5, 7, 10, 11, 12, 14, 17
};
*** Bu stratejide backtest yapılamaz. Matriks Deneme Ortamında çalıştırılıp test edilebilir.
1-Head Shoulder Tops
2-Head Shoulder Bottoms
3-Triple Tops
4-Triple Bottoms
5-Double Tops
6-Double Bottoms
7-Broadening Formation Asc.
8-Broadening Formation Desc.
9-Triangles Asc.
10-Triangles Desc.
11-Triangles Sym.
12-Wedges Asc.
13-Wedges Desc.
14-Wedges Rising
15-Wedges Falling
16-Flag/Pennant Rising
17-Flag/Pennant Falling
using System;
using System.Collections.Generic;
using System.Linq;
using Matriks.Data.Symbol;
using Matriks.Engines;
using System.Windows.Media;
using Matriks.Indicators;
using Matriks.Symbols;
using Matriks.AlgoTrader;
using Matriks.Trader.Core;
using Matriks.Trader.Core.Fields;
using Matriks.Trader.Core.TraderModels;
using Matriks.Lean.Algotrader.AlgoBase;
using Matriks.Lean.Algotrader.Models;
using Matriks.Lean.Algotrader.Trading;
/*
Düşen formasyon onaylandığında açığa satış yapacak ve (yarı hedef fiyatı-onaylanma fiyatı)/onaylanma fiyatı*100 oranında kar al ve zarar durdur eklenecek.
Strateji açığa sat ile başlayıp sıralı ilerleyecektir.
*** Düşen formasyon listesinde istenmeyen formasyonların index numarası silinebilir.
List<int> dusenFormasyon = new List<int>()
{
1, 3, 5, 7, 10, 11, 12, 14, 17
};
*** Bu stratejide backtest yapılamaz. Matriks Deneme Ortamında çalıştırılıp test edilebilir.
1-Head Shoulder Tops
2-Head Shoulder Bottoms
3-Triple Tops
4-Triple Bottoms
5-Double Tops
6-Double Bottoms
7-Broadening Formation Asc.
8-Broadening Formation Desc.
9-Triangles Asc.
10-Triangles Desc.
11-Triangles Sym.
12-Wedges Asc.
13-Wedges Desc.
14-Wedges Rising
15-Wedges Falling
16-Flag/Pennant Rising
17-Flag/Pennant Falling
*/
namespace Matriks.Lean.Algotrader
{
public class DusenFormasyon : MatriksAlgo
{
// Strateji çalıştırılırken kullanacağımız parametreler. Eğer sembolle ilgili bir parametre ise,
// "SymbolParameter" ile, değilse "Parameter" ile tanımlama yaparız. Parantez içindeki değerler default değerleridir.
[SymbolParameter("FGARAN")]
public string Symbol;
[Parameter(1)]
public decimal SellOrderQuantity;
List<int> dusenFormasyon = new List<int>()
{
1, 3, 5, 7, 10, 11, 12, 14, 17
};
/// <summary>
/// Strateji ilk çalıştırıldığında bu fonksiyon tetiklenir. Tüm sembole kayit işlemleri,
/// indikator ekleme, haberlere kayıt olma işlemleri burada yapılır.
/// </summary>
public override void OnInit()
{
AddSymbol(Symbol, SymbolPeriod.Min60);
AddFormationSymbol(Symbol);
SendOrderSequential(true, Side.Sell);
WorkWithPermanentSignal(true);
}
decimal confirmationPrice, halfPriceTarget, priceTarget, yuzde;
public override void OnFormationReceived(AlgoFormationModel formationModel)
{
if (dusenFormasyon.Contains(formationModel.FormationType) &&
formationModel.FormationStatus.ToString() == "Confirmed" &&
LastOrderSide.Obj != Side.Sell)
{
confirmationPrice = (decimal) formationModel.ConfirmationPrice;
halfPriceTarget = (decimal) formationModel.HalfPriceTarget;
priceTarget = (decimal) formationModel.PriceTarget;
if (confirmationPrice != 0)
{
yuzde = -1 * Math.Round((halfPriceTarget - confirmationPrice) / confirmationPrice * 100, 2);
}else
{
yuzde = 2;
}
SendMarketOrder(Symbol, SellOrderQuantity, OrderSide.Sell);
Debug("Satış emri gönderildi.[ " + SellOrderQuantity + " adet ]");
Debug("StopLevel: " + yuzde);
StopLoss(Symbol, SyntheticOrderPriceType.Percent, yuzde);
TakeProfit(Symbol, SyntheticOrderPriceType.Percent, yuzde);
Debug("Inform Time: " + formationModel.InformTime);
Debug("Description: " + formationModel.Description);
Debug("Name: " + formationModel.Name);
Debug("Formation Status: " + formationModel.FormationStatus);
//Onaylanmamış formasyonlarda ConfirmationDate alanında varsayılan bir tarih görebilirsiniz
Debug("Confirmation Price: " + formationModel.ConfirmationPrice);
Debug("Formation Type: " + formationModel.FormationType);
Debug("Price Target: " + formationModel.PriceTarget);
Debug("Half Price Target: " + formationModel.HalfPriceTarget);
}
}
}
}