MetaTrader4 code for price extremes indicator Indicator buffers: #property indicator_chart_window #property indicator_buffers 2 #property indicator_color1 Yellow #property indicator_color2 Blue extern int CountedPeriod=5; Buffer names: double hi[]; // for high border double lo[]; // for low border This code is for a one-minute time frame, which will search for the minimum and maximum for a five-minute time frame period, and display it on a chart. void init(){ //---- indicators SetIndexStyle(0,DRAW_LINE); SetIndexBuffer(0,hi); SetIndexStyle(1,DRAW_LINE); SetIndexBuffer(1,lo); //---- if(CountedPeriod < Period()){CountedPeriod=Period();} return;} void deinit(){return;} void start(){ int i, x, y, counted = IndicatorCounted(); if (counted > 0) counted--; int limit = Bars - counted; int per = CountedPeriod; string sy = Symbol(); SetIndexShift(0,per/Period()); SetIndexShift(1,per/Period()); //---- for(i=1;i < limit;i++){ hi[i]=iHigh(sy,per,iBarShift(sy,per,iTime(sy,Period(),i))); lo[i]=iLow (sy,per,iBarShift(sy,per,iTime(sy,Period(),i))); } //---- return;} I used custom functions for getting data from an indicator I created called hl.ex4. The code for the variables is: double sss=iCustom(NULL,0,"helo",0,0); // higher value double bbb=iCustom(NULL,0,"helo",1,0); // lower value The trigger for opening a short position is: if (Low[2] > sss &&Low[1] > sss) { OrderSend(Symbol(), OP_SELL, lots1, MarketInfo(Symbol(),MODE_BID), 3,0,0 , "", 777,0, Lime); } The trigger for opening a long position is: if (High[2] < bbb &&High[1] < bbb) { OrderSend(Symbol(), OP_BUY, lots1, MarketInfo(Symbol(),MODE_ASK), 3,0,0 , "", 777,0, Lime); } --Voznjuk Vladimir Vladimirovich
Thank you UBZEN where do I go from here?
You haven't said what your current issue is ?
Raptor I have copied a code fron Stocks and Commodities magizine for a FX Scapling indicator.
Stocks and Comm. puts codes on their web site which can be "copied and pasted" authorized by the code author.
I am attempting to put this code in my MT4 custom indicators list.
I have the code as a "shortcut" I need to convert it to .ex4 or mq4 file.
Then load it to c:Program Files/Oanda-Metatrader/Experts/Indicators folder.
I can't seem to save it without it being a short cut.
Raptor I have copied a code fron Stocks and Commodities magizine for a FX Scapling indicator.
Stocks and Comm. puts codes on their web site which can be "copied and pasted" authorized by the code author.
I am attempting to put this code in my MT4 custom indicators list.
I have the code as a "shortcut" I need to convert it to .ex4 or mq4 file.
Then load it to c:Program Files/Oanda-Metatrader/Experts/Indicators folder.
I can't seem to save it without it being a short cut.
You need to find the actual file not the shortcut . . . the shortcut is just a link to the file. Right click on the shortcut and then click properties so you caan see the location of the file. Go to that location and find the file, then copy the file to your MT4/experts/indicators folder and reboot MT4 . . . this should compile the code. But you have pasted the code above . . . so you must know where the file is or did you paste it from the website ?
OK, here is your code from above copied and pasted into MetaEditor and fixed a little so it compiles . . .
You need to find the actual file not the shortcut . . . the shortcut is just a link to the file. Right click on the shortcut and then click properties so you caan see the location of the file. Go to that location and find the file, then copy the file to your MT4/experts/indicators folder and reboot MT4 . . . this should compile the code. But you have pasted the code above . . . so you must know where the file is or did you paste it from the website ?
Raptor-when click on the short cut on my desk top it brings up the web site.
Teaching you basic computer skills is off topic for this Forum . . . you need to learn some stuff yourself . . . anything you have ever done is kids play compared to trying to trade Forex. Just download the file I attached above . . .
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
MetaTrader4 code for price extremes indicator
Indicator buffers:
#property indicator_chart_window
#property indicator_buffers 2
#property indicator_color1 Yellow
#property indicator_color2 Blue
extern int CountedPeriod=5;
Buffer names:
double hi[]; // for high border
double lo[]; // for low border
This code is for a one-minute time frame, which will search for the minimum and maximum
for a five-minute time frame period, and display it on a chart.
void init(){
//---- indicators
SetIndexStyle(0,DRAW_LINE);
SetIndexBuffer(0,hi);
SetIndexStyle(1,DRAW_LINE);
SetIndexBuffer(1,lo);
//----
if(CountedPeriod < Period()){CountedPeriod=Period();}
return;}
void deinit(){return;}
void start(){
int i, x, y, counted = IndicatorCounted();
if (counted > 0) counted--;
int limit = Bars - counted;
int per = CountedPeriod;
string sy = Symbol();
SetIndexShift(0,per/Period());
SetIndexShift(1,per/Period());
//----
for(i=1;i < limit;i++){
hi[i]=iHigh(sy,per,iBarShift(sy,per,iTime(sy,Period(),i)));
lo[i]=iLow (sy,per,iBarShift(sy,per,iTime(sy,Period(),i)));
}
//----
return;}
I used custom functions for getting data from an indicator I created called hl.ex4. The
code for the variables is:
double sss=iCustom(NULL,0,"helo",0,0); // higher value
double bbb=iCustom(NULL,0,"helo",1,0); // lower value
The trigger for opening a short position is:
if (Low[2] > sss &&Low[1] > sss)
{
OrderSend(Symbol(), OP_SELL, lots1, MarketInfo(Symbol(),MODE_BID), 3,0,0 , "", 777,0, Lime);
}
The trigger for opening a long position is:
if (High[2] < bbb &&High[1] < bbb)
{
OrderSend(Symbol(), OP_BUY, lots1, MarketInfo(Symbol(),MODE_ASK), 3,0,0 , "", 777,0, Lime);
}
--Voznjuk Vladimir Vladimirovich