PDA

View Full Version : 3 minute chart



manishbaba
10-25-2015, 11:53 AM
Hi
Can anyone please guide me how to change the time frame of chart to 3 minute.
As we see a period converter in Mt4, is something analogous to that is present here.


Regards

Rawan-HS
10-29-2015, 06:49 AM
Dear manishbaba

the below code is to calculate the candles prices at the period you set such as 3 min check it and tell me if you need any things



dim selectedMin
Dim i
Dim j


Dim openPrice()
Dim highPrice()
Dim lowPrice()
Dim closePrice()


Public Sub main()
''''TODO: Script program start method
dim a
reDim preserve openPrice( (bars(0) - (bars(0) Mod selectedMin)) / selectedMin -1)
reDim preserve highPrice((bars(0) - (bars(0) Mod selectedMin)) / selectedMin -1 )
reDim preserve lowPrice( (bars(0) - (bars(0) Mod selectedMin)) / selectedMin -1 )
reDim preserve closePrice( (bars(0) - (bars(0) Mod selectedMin)) / selectedMin -1)
for i = i+1 to (bars(0) - (bars(0) Mod selectedMin)) step selectedMin
openPrice(j) = cdbl(getOpen(0, Clng(i)))
closePrice(j)= cdbl(getClose(0,Clng(i)+selectedMin-1))
For a = i To i + selectedMin -1
if a= i then
highPrice(j) = getHigh(0,Clng(a))
end if
If highPrice(j) < getHigh(0,Clng(a)) Then
highPrice(j) = getHigh(0,Clng(a))
End If
if a= i then
lowPrice(j) = getlow(0,Clng(a))
end if
if lowPrice(j) > getlow(0,Clng(a)) Then
lowPrice(j) = getlow(0,Clng(a))
End If
Next
'alertMessage j & " " & ubound( openprice ) & " " & ubound( highprice ) & " " & ubound( lowprice ) & " " & ubound( closeprice )
j = j + 1
Next
Dim Str
For i=ubound(lowPrice) to lbound(lowPrice) step -1
Str= "Candle:" & i+1 & " Open: " & openPrice(i) & " High: " & HighPrice(i) & " Low: " & lowPrice(i) & " Close: " & ClosePrice(i)
' AlertMessage Cstr(Str),"Candle:" & i+1
Next
End Sub

Public Sub OnInit()


''''TODO: initialization method

if ChartPeriod = 1 then
selectedMin = Clng(InputBox("Enter the period value in minutes"))
While not(IsNumeric(selectedMin))
selectedMin=InputBox("Enter a valid pertiod value")
wend
else
AlertMessage "this script run only in period 1 min "
end if
End Sub