-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathaddindicator_ea.js
More file actions
35 lines (34 loc) · 872 Bytes
/
addindicator_ea.js
File metadata and controls
35 lines (34 loc) · 872 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
registerEA(
"add_indicator", // name
"A test EA to add an indicator automatically", // description
[{
name: "symbolName",
value: "EUR/USD",
required: true,
type: "String", // Integer, Number, Boolean
range: null,
step: null
}, {
name: "period",
value: 20,
required: true,
type: "Integer",
range: [1, 100],
step: null
}], // parameter
function (context) { // Init()
var account = getAccount(context, 0)
var brokerName = getBrokerNameOfAccount(account)
var accountId = getAccountIdOfAccount(account)
var symbolName = getEAParameter(context, "symbolName")
var period = getEAParameter(context, "period")
window.indiHandle = getIndicatorHandle(context, brokerName, accountId, symbolName, TIME_FRAME.M1, "sma", [{
name: "period",
value: period
}])
},
function (context) { // Deinit()
delete window.indiHandle
},
function (context) { // OnTick()
})