| New signals service! | |
|
|||||||
| Register in Forex TSD! | |
|
Trading Systems Leaders in this forum (automated trading systems) are winning more than 3000 pips in a month (30000$ investing one lot every time). Click here to register and get more information |
|
![]() |
|
|
LinkBack | Thread Tools | Display Modes |
|
|||
|
Quote:
![]() ![]() |
|
|||
|
here's how magic was done:
code before: ....... double marsioma[]; double marsiomaXSig[]; string short_name; //+------------------------------------------------------+ //| Custom indicator initialization function | //+------------------------------------------------------+ ........ SetIndexLabel(2,"TrendUp"); SetIndexLabel(6,"Up/DnXsig"); IndicatorShortName(short_name); SetIndexDrawBegin(0,RSIOMA); SetIndexDrawBegin(1,RSIOMA); SetIndexDrawBegin(2,RSIOMA); SetIndexDrawBegin(3,RSIOMA); SetIndexDrawBegin(4,RSIOMA); SetIndexDrawBegin(5,RSIOMA); SetIndexDrawBegin(6,RSIOMA); SetIndexDrawBegin(7,RSIOMA); //---- drawLine(BuyTrigger,"BuyTrigger", BuyTriggerColor); .............. //+----------------------------------------------------+ //| Relative Strength Index | //+-----------------------------------------------------+ int start() { int i, ii; int counted_bars=IndicatorCounted(); double rel,negative,positive; //---- if(Bars<=RSIOMA) return(0); //---- initial zero if(counted_bars<1) for(i=1;i<=RSIOMA;i++) {RSIBuffer[Bars-i]=0.0;} //---- ii=Bars-RSIOMA-1; if(counted_bars>=RSIOMA) ii=Bars-counted_bars-1; i = ii; while(i>=0) { MABuffer1[i]=iMA(Symbol(),0,RSIOMA,0,RSIOMA_MODE,RSIOMA_PRICE, i); i--; } i=ii; while(i>=0) { RSIBuffer[i]=iRSIOnArray(MABuffer1,0,RSIOMA,i); if(RSIBuffer[i]>50) bup[i] = 6; if(RSIBuffer[i]<50) bdn[i] = -6; Last edited by fxbs; 08-23-2007 at 07:54 AM. |
|
|||
|
code after:
.................. datetime lastBarTime; string short_name; //+------------------------------------------------------------------+ //| Custom indicator initialization function | //+------------------------------------------------------------------+ SetIndexLabel(2,"TrendUp"); SetIndexLabel(6,"Up/DnXsig"); for (int i=0;i<indicator_buffers;i++) SetIndexDrawBegin(i,RSIOMA); // // additional buffer(s) ArraySetAsSeries(MABuffer1,true); ArrayResize(MABuffer1,Bars); ArrayInitialize(MABuffer1,EMPTY_VALUE); lastBarTime = EMPTY_VALUE; // drawLine(BuyTrigger,"BuyTrigger", BuyTriggerColor); .............. //+------------------------------------------------------------------+ //| | //+------------------------------------------------------------------+ int start() { int counted_bars=IndicatorCounted(); int i, limit; if(Bars<=RSIOMA) return(0); if(counted_bars<1) for(i=1;i<=RSIOMA;i++) RSIBuffer[Bars-i]=0.0; if (lastBarTime != Time[0]) { lastBarTime = Time[0]; ArrayResize(MABuffer1,Bars); ArrayInitialize(MABuffer1,EMPTY_VALUE); counted_bars=0; } limit=Bars-RSIOMA-1; if(counted_bars>=RSIOMA) limit=Bars-counted_bars-1; for(i=limit;i>=0;i--) MABuffer1[i]=iMA(Symbol(),0,RSIOMA,0,RSIOMA_MODE,RSIOMA_PRICE, i); for(i=limit;i>=0;i--) { RSIBuffer[i]=iRSIOnArray(MABuffer1,0,RSIOMA,i); if(RSIBuffer[i]>50) bup[i] = 6; if(RSIBuffer[i]<50) bdn[i] = -6; Last edited by fxbs; 08-23-2007 at 07:57 AM. |
|
||||
|
Quote:
we have 8 buffers avaliable in metatrader, but buffers are special arrays that allows us to draw something on the chart. So we could use them to draw: 1) rsioma 2) marsiona 3) green histogram 4) red histogram 5) pink histogram 6) blue histogram 7) short signal dot (up or down) 8) long signal dot (up or down) To do something like that you need: 1) use an array instead of buffer array. This will require from you to define an double array in the global section for the moving average calculation, then at the begining of the start function - resize it to full buffer size, then fill it with iMA function and use like a buffer. In this way you will have one free buffer to draw. OR 2) leave everything as it is, write a function that will draw ARROW OBJECT with code choosen by you (arrow, dot or something else from wingdings) and manage those arrows. It means that this function should draw arrow on right window with value that you would usualy assign to buffer. Both solutions are very easy. I could do it if you could write when and which arrow/dot should be draw - and please attach screenshot (eg. draw in paint).
__________________
You need proffesional mql coder? Contact me! I will help you! ........................................ http://www.fxservice.eu/ ........................................ |
|
||||
|
In fact, I see that Mladen done a good job. And modified this indicator already. In his version you have 1 buffer free to go (take a look that this indicator is using buffers from 0 to 6 and we can use from 0 to 7) so you can use it to generate the signal that you want just as a usual buffer.
BTW great hint Mlanden with that ArraySetAsSeries
__________________
You need proffesional mql coder? Contact me! I will help you! ........................................ http://www.fxservice.eu/ ........................................ |
|
|||
|
Quote:
![]() ![]() Last edited by fxbs; 08-23-2007 at 08:17 AM. |
|
|||
|
And since it's your version, could you consider to add CountedBars and refreshing bufers options?
![]() (autentic - by the author himself) (and I can do all the hard work - desiding on the colors?) ![]() Quote:
Last edited by fxbs; 08-23-2007 at 08:37 AM. |
![]() |
| Bookmarks |
| Tags |
| RSIOMA, RSIOMA INDICATOR |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Unauthorized Extra Charges on may credit statement | Navid | General Discussion | 10 | 05-11-2007 04:12 PM |
| MT4 with extra weekend bar | woteva | Metatrader 4 | 3 | 04-30-2007 03:13 AM |
| Help with buffer limits and flatlining indicator lines | iboersma | Indicators - Metatrader 4 | 0 | 03-22-2007 06:27 PM |