-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy pathEntryBar_ATR_Stop_LX.Strategy.CS
More file actions
35 lines (29 loc) · 949 Bytes
/
EntryBar_ATR_Stop_LX.Strategy.CS
File metadata and controls
35 lines (29 loc) · 949 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
34
35
using PowerLanguage.Function;
namespace PowerLanguage.Strategy
{
[IOGMode(IOGMode.Disabled)]
public class EntryBar_ATR_Stop_LX : SignalObject
{
private IOrderPriced m_EbAtrSX;
public EntryBar_ATR_Stop_LX(object ctx) :
base(ctx){
NumAtrs = 1;
AtrLength = 5;
}
[Input]
public int AtrLength { get; set; }
[Input]
public int NumAtrs { get; set; }
protected override void Create(){
m_EbAtrSX =
OrderCreator.Stop(new SOrderParameters(Contracts.Default, "EbAtrSX", EOrderAction.BuyToCover,
OrderExit.FromAll));
}
protected override void CalcBar(){
if (StrategyInfo.MarketPosition >= 0)
{
m_EbAtrSX.Send(Bars.Close[0] + this.AverageTrueRange(AtrLength)*NumAtrs);
}
}
}
}