-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy pathCustom_Strategy_SX.Strategy.CS
More file actions
33 lines (26 loc) · 926 Bytes
/
Custom_Strategy_SX.Strategy.CS
File metadata and controls
33 lines (26 loc) · 926 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
using System;
namespace PowerLanguage.Strategy
{
public class Custom_Strategy_SX : SignalObject
{
private IOrderMarket m_CustomSX;
public Custom_Strategy_SX(object ctx) :
base(ctx) {}
private ISeries<bool> SX_Condition { get; set; }
protected override void Create(){
m_CustomSX =
OrderCreator.MarketNextBar(new SOrderParameters(Contracts.Default, "CustomSX",
EOrderAction.BuyToCover, OrderExit.FromAll));
}
protected override void StartCalc(){
SX_Condition =
new Lambda<Boolean>(
_bb => PublicFunctions.DoubleGreater(Bars.Close[_bb], Bars.Open[_bb]));
}
protected override void CalcBar(){
if (SX_Condition[0]){
m_CustomSX.Send();
}
}
}
}