- Problem With LotSize
- CAn some body help me to change a color of one line my indicator
- Problem in code
work fine for me
Thanks for your reply Are you sure because if you see it doesn't show lines in m1 m5 and m15 charts yellow and red ??
oops my mistake
i thought you were talking about the MA lines sorry
oops my mistake
i thought you were talking about the MA lines sorry
Not an issue but can you help me why this is happening??
Hi the code is not running in m1,m5 and m15 cahrt on't know why can some body help to sort out this problem Thanks
The default setting
extern double DistancePips=300;
and
if(fastsma>=slowsma && fastsma>=MarketInfo(Symbol(),MODE_BID)+(NormalizeDouble(DistancePips*mPoint,Digits)))
if(fastsma<=slowsma && fastsma<=MarketInfo(Symbol(),MODE_BID)-(NormalizeDouble(DistancePips*mPoint,Digits)))
How often do you think that the the sma will be 300 pips above or below Bid in the lower timeframes?
Hi the code is not running in m1,m5 and m15 cahrt on't know why can some body help to sort out this problem Thanks
When you say not running, it means you don't see anything on the chart, do you get any errors at all?
Can you explain what you want this indicator to do ? And what is this MarioIndicator ?
If the yellow and red horizontal lines are what you're looking for, you need to explain your calculations because you can't see lines on M1 chart if they are 1000 pips away.
Give some more details if you can.
Cheers.
When you say not running, it means you don't see anything on the chart, do you get any errors at all?
Can you explain what you want this indicator to do ? And what is this MarioIndicator ?
If the yellow and red horizontal lines are what you're looking for, you need to explain your calculations because you can't see lines on M1 chart if they are 1000 pips away.
Give some more details if you can.
Cheers.
Hi thanks for your reply if you see the code above what i m going here is making an indicator which show lines yellow when fast bollinger crosses low to up the slow bollinger and vice versa .I have filtered by using certain bars criteria so that it only show the yellow and red about this criteria .Lets say i have inputted 50 bars then it will show only lines which satisfy this criteria between 50 bars.Now where i m getting problem is when i m using criteria number two is the maket price.I m filtering using market value price like current market value price+Input pip.So i mtrying to see the yellow lines and red lines .
When fast bollinger us also greater than current market value +pips value then it show only those lines which satisfy this criteria and vice viceversa.
Thanks
Hi thanks for your reply if you see the code above what i m going here is making an indicator which show lines yellow when fast bollinger crosses low to up the slow bollinger and vice versa .I have filtered by using certain bars criteria so that it only show the yellow and red about this criteria .Lets say i have inputted 50 bars then it will show only lines which satisfy this criteria between 50 bars.Now where i m getting problem is when i m using criteria number two is the maket price.I m filtering using market value price like current market value price+Input pip.So i mtrying to see the yellow lines and red lines .
When fast bollinger us also greater than current market value +pips value then it show only those lines which satisfy this criteria and vice viceversa.
Thanks
I get you man. Let's start by fixing some errors, OK?
The obvious one is the way you try to get the values for upper and lower bands :
double fastPre=iBands(NULL,0,InpFastSMA,FastInpdev,0,PRICE_CLOSE,MODE_SMA,limit+1); double slowPre =iBands(NULL,0,InpSlowSMA,SlowInpdev,0,PRICE_CLOSE,MODE_SMA,limit+1); double fastsma=iBands(NULL,0,InpFastSMA,FastInpdev,0,PRICE_CLOSE,MODE_SMA,limit); double slowsma =iBands(NULL,0,InpSlowSMA,SlowInpdev,0,PRICE_CLOSE,MODE_SMA,limit);
For Bollinger Bands you have a buffer that holds values for upper band and one buffer for lower band for each bar . You can't have MODE_SMA . I suggest you try to highlight iBands in your code and press F1.
Use it any time you're not sure or want to check your code.
Here is what you get :
iBands(NULL,0,20,2,0,PRICE_LOW,MODE_LOWER,0);
You can have PRICE_CLOSE, PRICE_LOW, etc, but not MODE_SMA.
Now, I'll let you figure out how to get the correct value for the upper band .... ; )
Also, it's easier for everyone if you use more meaningful names for your variables (ie : fastLowerBand or fastUpper, slowUpper etc) .
And again, what is and what purpose serves this :
winIndex = WindowFind("MarioIndicator"); if( winIndex == -1 ) winIndex = 1;
Remember, I'm not very good at explaining things so if you have any questions just ask.
I'll be back with more.
Ready for a bit more fun ? Nothing to worry about, you did a good job, just some bits and pieces to fix.
1. You don't declare 4 buffers if you only need 2
#property indicator_buffers 2
2. Don't leave #import like that and don't double either :
#import // delete this #import "Kernel32.dll" #property indicator_buffers 4 #property indicator_color1 Yellow #property indicator_color2 Red #property indicator_color1 Yellow // delete this #property indicator_color2 Red // delete this
3. Which one you want to use ?
extern color color1=Yellow; extern color color2=Red; extern color color3=Yellow; extern color color4=Red; // or #property indicator_color1 Yellow #property indicator_color2 Red
4.Delete this
winIndex = WindowFind("MarioIndicator"); if( winIndex == -1 ) winIndex = 1;
5. int OnInit() has to return an int value . If no value, then return(0);
We should discuss Start function last, after we fix all other stuff.
6. Please don't do this :
void deinit() { for(int i = ObjectsTotal() -1; i >=0; i--) { ObjectDelete(ObjectName(i)); } }
It will delete everything, trend lines,fibs, any object on chart even when you switch time frames everything goes away. Use this instead, I'll show you how to create object name t work with it :
//+------------------------------------------------------------------+ //| | //+------------------------------------------------------------------+ void deinit() { for(int i=ObjectsTotal(); i>=0; i--) { string name1="slowsma"+i; string name2="fastsma"+i; string name =ObjectName(i); if(name==name1 || name==name2) ObjectDelete(0,name); } } //+------------------------------------------------------------------+
7. Function pips is of double type and returns an int type (pipsmultiplier) !
double pips(string sym1)
Change to int type .
Now, to create name for your lines, a simple way would be by adding a counter to the name instead of time .
int pips=0,objectCount=0; // objectCount is my counter of objects
objectCount gets added to the name of the object and then increased by one :
if(ObjectFind("fastsma"+objectCount)==-1) { ObjectCreate("fastsma"+objectCount,OBJ_HLINE,0,Time[0],fastsma,0); ObjectSet("fastsma"+objectCount,OBJPROP_COLOR,color1); ObjectSet("fastsma"+objectCount,OBJPROP_STYLE,STYLE_DASH); objectCount++; WindowRedraw();
or you can have :
string lineName="fastema"+objectCount; if(ObjectFind(lineName)==-1) { ObjectCreate(lineName,OBJ_HLINE,0,Time[0],fastsma,0); ObjectSet(lineName,OBJPROP_COLOR,color1); ObjectSet(lineName,OBJPROP_STYLE,STYLE_DASH); objectCount++; WindowRedraw(); } lineName="slowema"+objectCount; if(ObjectFind(lineName)==-1) {....
Same for "slowema".
You still end up with a bunch of lines. If you want 1 line only you should think about ObjectMove.
Are we good so far ?
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use