Getting a price at a Fibonnaci percentage level is a straightforward mathematical calculation.
We just need to define 3 things:
1. Price at 100%
2. Price at 0%
3. Percentage to return Price at
This is a script illustrating all the calculation needed:
#property strict #property show_inputs input double inp_price_100 = 0.0; //Price at 100% input double inp_price_0 = 0.0; //Price at 0% input double inp_percentage = 61.8; //Percentage to return Price at void OnStart(){ double priceDifference = MathAbs(inp_price_0 - inp_price_100) * inp_percentage/100; //get the price difference between the required percentage level and 0% Print((inp_price_100 > inp_price_0) ? NormalizeDouble(inp_price_0 + priceDifference, Digits) : NormalizeDouble(inp_price_0 - priceDifference, Digits)); }
You just need these 2 lines to to obtain your required price for further action within an EA.
Amazing! Thank you so much 🙂