- Fibonacci levels in MQL4
- Fibo level order script or EA
- How can I have 2 fibo Retracement in mt4?
I've tried coding this but after hours really haven't had much luck getting it to work even after reading through the docs =\ Can someone please help me, the basic code I have is simply this:
double fibo0 = ObjectGet("Fibo", OBJPROP_FIRSTLEVEL+1);
There is only 1 fibo object that I have hand drawn on the chart, name is Fibo 31713. How can I get the price values of the different fibo levels?
You can't get the price of the different levels directly. You must calculate them.
You'll need to get the price of the 2 points the fib is drawn from and the fib level.
From those, you can calculate the price.
string name="Fibo 31713"; double price0 = ObjectGetDouble(0,name,OBJPROP_PRICE,0), price1 = ObjectGetDouble(0,name,OBJPROP_PRICE,1), fiblevel = ObjectGetDouble(0,name,OBJPROP_LEVELVALUE,0), fibprice = price1-((price1-price0)*fiblevel); Print(fibprice);
Is there anyway to pull the price directly off a hand drawn fibo on the chart or do I have to "draw" the fib in the script first? I'm trying to basically make a script to buy/sell at certain levels based on a manually drawn fib on the chart.
So, on a fresh chart, if I were to randomly draw a fib, I want a script when executed on that chart, would automatically make pending buys/sells at certain fib levels from the manually drawn fib on the chart.
Is there anyway to pull the price directly off a hand drawn fibo on the chart or do I have to "draw" the fib in the script first? I'm trying to basically make a script to buy/sell at certain levels based on a manually drawn fib on the chart.
So, on a fresh chart, if I were to randomly draw a fib, I want a script when executed on that chart, would automatically make pending buys/sells at certain fib levels from the manually drawn fib on the chart.
SImply ensure that the script can to refer to the name of the (Fib) Object, either directly or indirectly.
The rather more challenging issue is to actually make Fib entries profitable.
Could you please show me an example of how to refer to the manually drawn object without "drawing" a fib from point a/b within the script? :)
I have been trading a strategy manually with a pretty decent profit for about 2 months now, I only use fib levels as general points of entry, but then I manually manage each trade to conclusion.
O, sorry, I'm new to coding mql4 coming from a php background =\ I misunderstood you're code, I thought you were telling me to create a new fibo in the script, didn't realize that was the code to read in fibo information as well.
Is there anyway to make it a wildcard Fibo name? I tried Fibo*, Fibo%, Fibo+*, Fibo+% and nothing seemed to work. I only have 1 fibo on each chart, so it wouldn't need to distinguish between multiple fibos.
You'll need to loop through the objects on the chart and look for a tag match.
string tag="MyFib"; for(int i=0; i<ObjectsTotal(); i++) { string name=ObjectName(i); if(ObjectType(name)!=OBJ_FIBO) { continue; } if(StringSubstr(name,0,StringLen(tag))!=tag) { continue; } double price0 = ObjectGetDouble(0,name,OBJPROP_PRICE,0), price1 = ObjectGetDouble(0,name,OBJPROP_PRICE,1), fiblevel = ObjectGetDouble(0,name,OBJPROP_LEVELVALUE,0), fibprice = price1-((price1-price0)*fiblevel); Print(fibprice); }

- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use