Miscellaneous
0
Views
0
Downloads
0
Favorites
#TickPrice
//+------------------------------------------------------------------+
//| #TickPrice.mq4 |
//| |
//| |
//+------------------------------------------------------------------+
#property copyright "JDP"
#property link ""
#property indicator_buffers 2
#property indicator_color1 White
#property indicator_color2 White
#property indicator_separate_window
double bid[],ask[];
extern bool MoveObjects=true;
int LastTm;
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
{
//---- indicators
SetIndexStyle(0,DRAW_LINE,STYLE_SOLID,1);
SetIndexBuffer(0,ask);
SetIndexLabel(0,"Ask");
SetIndexStyle(1,DRAW_LINE,STYLE_SOLID,1);
SetIndexBuffer(1,bid);
SetIndexLabel(1,"Bid");
string shortname=Symbol()+"-#TickPrice";
IndicatorShortName(shortname);
LastTm = Time[0];
//----
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function |
//+------------------------------------------------------------------+
int deinit()
{
//----
//----
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator iteration function |
//+------------------------------------------------------------------+
int start()
{
int i,total,oTm;
int counted_bars=IndicatorCounted();
//----
if (LastTm < Time[0]) {
for (i = 0;i<1000;i++) {
ask[i] = ask[i+1];
bid[i] = bid[i+1];
}
if (MoveObjects==true) {
total = ObjectsTotal();
for (i=0;i<total;i++) {
oTm =ObjectGet(ObjectName(i),OBJPROP_TIME1);
oTm = oTm + (60*Period());
ObjectSet(ObjectName(i),OBJPROP_TIME1,oTm);
}
}
LastTm = Time[0];
}
for (i = 1001;i>0;i--) {
ask[i] = ask[i-1];
bid[i] = bid[i-1];
}
if (MoveObjects==true) {
total = ObjectsTotal();
for (i=0;i<total;i++) {
oTm =ObjectGet(ObjectName(i),OBJPROP_TIME1);
oTm = oTm - (60*Period());
ObjectSet(ObjectName(i),OBJPROP_TIME1,oTm);
}
}
ask[0] = Ask;
bid[0] = Bid;
//----
return(0);
}
//+------------------------------------------------------------------+
Comments
Markdown Formatting Guide
# H1
## H2
### H3
**bold text**
*italicized text*
[title](https://www.example.com)

`code`
```
code block
```
> blockquote
- Item 1
- Item 2
1. First item
2. Second item
---