Фьючерс РТС. Стратегия N3

RTS Фьючерс. Timeframe 10 min. 2016-2021.

Дополнительный фильтр(условие) к Стратегии Фьючерс РТС. Стратегия N1

only long / without commission

Код


using System;
using System.Drawing;

using OpenQuant.API;
using OpenQuant.API.Indicators;

public class MyStrategy : Strategy
{
	[Parameter("Order quantity (number of contracts to trade)")]
	double Qty = 1;
	double A =0;

	BarSeries series;

	
	public override void OnStrategyStart()
	{
		
	
		BarSeries series = GetBars(BarType.Time,86400) ;
	
		}
	
	
	
	
	public override void OnBarSlice(long size)
	{

		
		if (Bars.Count > 1)
		
	 A= ((Bar.Close-Bars.Last.Open)/Bars.Last.Open)*100;
		
		
	{
			
         
		if (!HasPosition)
		{
			//Rules
				
			if ( A<=3 &	Clock.Now.Hour == 17
				
			
				& Bar.DateTime.DayOfWeek!=DayOfWeek.Thursday 
				& Bar.DateTime.DayOfWeek!=DayOfWeek.Tuesday
				& Bar.DateTime.Year>=2016)
					
					
					
				
			{
				Buy(Qty);
			
						
			}
			
			

		}
			
		else
			
			
		{
			if 			
				(
				Clock.Now.Hour==23 & Clock.Now.Minute==30 )
			{
				Sell(Qty);
					
			}
				
			
			
		}
	}
		}

	

}