Miscellaneous
0
Views
0
Downloads
0
Favorites
Parabolic_best_TRO_MODIFIED_VERSION
//+------------------------------------------------------------------+
//| Parabolic best.mq4 |
//| Copyright © 2008, MetaQuotes Software Corp. |
//| Copyright © 2008, Ëóêàøóê Â.Ã. aka lukas1. |
//|îðèãèíàë ëåæèò ...? Íè÷åãî íå ìåíÿë,òîëüêî "îáðåçàíèå" íî ìàëåíüêîå
//+------------------------------------------------------------------+
//| Parabolic_best_TRO_MODIFIED_VERSION |
//| MODIFIED BY AVERY T. HORTON, JR. AKA THERUMPLEDONE@GMAIL.COM |
//| I am NOT the ORIGINAL author
// and I am not claiming authorship of this indicator.
// All I did was modify it. I hope you find my modifications useful.|
//| |
//+------------------------------------------------------------------+
// âñ¸ ëèøíåå âûêèíóë. aka lukas1.
// âñ¸ ïðàâèëüíî ðàáîòàåò. aka lukas1.
#property copyright "Copyright © 2008, MetaQuotes + lukas1"
#property link ""
#property indicator_chart_window
#property indicator_buffers 1
#property indicator_color1 Orange
//#property indicator_width3 1
//+--------- TRO MODIFICATION ---------------------------------------+
extern bool Sound.Alert = false ;
extern bool Show.PriceBox = true ;
extern int myBoxWidth = 3;
//---- input parameters
extern double Step=0.002;
extern int Diff=20; //ñäâèã íà÷àëà öåïî÷êè ïî âåðòèêàëè â ïîèíòàõ
extern int ilimit =144;
//---- buffers
double SarBuffer[];
//----
int save_lastreverse;
bool save_dirlong;
double save_start;
double save_last_high;
double save_last_low;
double save_ep;
double save_sar;
double save_delta;
//+--------- TRO MODIFICATION ---------------------------------------+
string symbol, tChartPeriod, tShortName ;
int digits, period ;
bool Trigger ;
int OldBars = -1 ;
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
{
//+--------- TRO MODIFICATION ---------------------------------------+
string symbol, tChartPeriod, tShortName ;
int digits, period ;
bool Trigger ;
int OldBars = -1 ;
period = Period() ;
tChartPeriod = TimeFrameToString(period) ;
symbol = Symbol() ;
digits = Digits ;
tShortName = "wl3"+ symbol + tChartPeriod ;
//---- indicators
IndicatorDigits(Digits+1);
//----
SetIndexStyle(0,DRAW_ARROW);
SetIndexArrow(0,159);
SetIndexBuffer(0,SarBuffer);
//----
return(0);
}
//+--------- TRO MODIFICATION ---------------------------------------+
int deinit()
{
ObjectDelete(tShortName+"01");
return(0);
}
//+------------------------------------------------------------------+
//| Ïåðåêëþ÷àòåëü - çàïîìèíàòåëü
//+------------------------------------------------------------------+
void SaveLastReverse(int last,int dir,double start,double low,double high,double ep,double sar)
{
save_lastreverse=last;
save_dirlong=dir;
save_start=start;
save_last_low=low;
save_last_high=high;
save_ep=ep;
save_sar=sar;
}
//+------------------------------------------------------------------+
//| Parabolic Sell And Reverse system |
//+------------------------------------------------------------------+
int start()
{
//+--------- TRO MODIFICATION ---------------------------------------+
if( Bars != OldBars ) { Trigger = True ; }
static bool first=false;
bool dirlong;
double start,last_high,last_low;
double ep,sar,price_low,price_high,price;
int i,counted_bars=IndicatorCounted();
int limit=ilimit;
// SetIndexDrawBegin(0,Bars-limit);
// SetIndexDrawBegin(1,Bars-limit);
//----
if(Bars<3) return(0);
dirlong=true;
start=Step;
//--------------------------------------------+
i=Bars-2;
while(i>=0)
{
price_low=Low[i];
price_high=High[i];
price=SarBuffer[i+1];//òåêóùàÿ öåíà ðàâíà SarBuffer ïðåäûäóùåãî áàðà
//sar ðàâåí öåíà ïðåäûäóùåãî áàðà ïëþñ øàã óìíîæèòü íà
//(ñòàðàÿ öåíà ìèíóñ çíà÷åíèå SarBuffer ïðåäûäóùåãî áàðà)
sar=price+start*(ep-price);
//----
if(dirlong)
{
start+=Step;
if(sar>price_low)
{
SaveLastReverse(i,true,start,price_low,last_high,ep,sar);
start=Step;
dirlong=false;
ep=price_low;
last_low=price_low;
SarBuffer[i]=last_high-Diff*Point;
if (SarBuffer[i]<High[i]&&SarBuffer[i]>=Low[i])
SarBuffer[i]=High[i]+Point;
if (SarBuffer[i]<Low[i]) SarBuffer[i]=Low[i]-Point;
i--;
continue;
}
if(ep<price_high) { last_high=price_high; ep=price_high; }
}
//----
else
{
start+=Step;
if(sar<price_high)
{
SaveLastReverse(i,false,start,last_low,price_high,ep,sar);
start=Step;
dirlong=true;
ep=price_high;
last_high=price_high;
SarBuffer[i]=last_low+Diff*Point;
if (SarBuffer[i]>Low[i]&&SarBuffer[i]<=High[i])
SarBuffer[i]=Low[i]-Point;
if (SarBuffer[i]>High[i]) SarBuffer[i]=High[i]+Point;
i--;
continue;
}
if(ep>price_low) { last_low=price_low; ep=price_low; }
}
SarBuffer[i]=sar;
i--;
}
//----
//+--------- TRO MODIFICATION ---------------------------------------+
if ( Trigger && Sound.Alert )
{
if( Close[0] > SarBuffer[0] && Close[1] < SarBuffer[1] ) { Trigger = False ; Alert(symbol," ", tChartPeriod, " Price above PSAR "+ DoubleToStr(SarBuffer[0] ,digits)); }
if( Close[0] < SarBuffer[0] && Close[1] > SarBuffer[1] ) { Trigger = False ; Alert(symbol," ", tChartPeriod, " Price below PSAR "+ DoubleToStr(SarBuffer[0] ,digits)); }
}
if(Show.PriceBox) { DoBox() ; }
OldBars = Bars ;
return(0);
}
//+------------------------------------------------------------------+
//+--------- TRO MODIFICATION ---------------------------------------+
void DoBox()
{
if (ObjectFind(tShortName+"01") != 0)
{
ObjectCreate(tShortName+"01",OBJ_ARROW,0,Time[0],SarBuffer[0]);
ObjectSet(tShortName+"01",OBJPROP_ARROWCODE,SYMBOL_RIGHTPRICE);
ObjectSet(tShortName+"01",OBJPROP_COLOR,indicator_color1);
ObjectSet(tShortName+"01",OBJPROP_WIDTH,myBoxWidth);
}
else
{
ObjectMove(tShortName+"01",0,Time[0],SarBuffer[0]);
ObjectSet(tShortName+"01",OBJPROP_COLOR,indicator_color1);
}
return(0);
}
//+--------- TRO MODIFICATION ---------------------------------------+
string TimeFrameToString(int tf)
{
string tfs;
switch(tf) {
case PERIOD_M1: tfs="M1" ; break;
case PERIOD_M5: tfs="M5" ; break;
case PERIOD_M15: tfs="M15" ; break;
case PERIOD_M30: tfs="M30" ; break;
case PERIOD_H1: tfs="H1" ; break;
case PERIOD_H4: tfs="H4" ; break;
case PERIOD_D1: tfs="D1" ; break;
case PERIOD_W1: tfs="W1" ; break;
case PERIOD_MN1: tfs="MN";
}
return(tfs);
}
//+--------- TRO MODIFICATION ---------------------------------------+
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
---