But, I need stoploss and targets also in the alert based on following simple calculation.
Assume our buy entry at 524.55.
Stoploss : Entry - 1.5% of the stock entry price (524.55 - 7.85 = 516.70)
Target 1 : Entry + 2.5% of the stock entry price (524.55 + 13.10 = 537.65)
Target 2 : Entry + 5% of the stock price (524.55 + 26.20 = 550.75)
(Note: Tick size is 0.05. So if stoploss or target calculation is comes an odd number, need to be rounded to nearest tick size. And if LSignal is a sell signal, need reverse calculation.
Finally I need following output:
Symbol Name (15M) --> Buy at 524.55, SL: 516.70, Target 1: 537.65, Target 2: 550.75
Can somebody please rewrite the code for my requirement?
TY in adv.
//Open Price double OP =524.55;
double SL_p =1.5; //Stop Loss % double TP1_p=2.5; //Take Profit 1 %double TP2_p=5; //Take Profit 2 %int d=Digits(); //assumed its the native symboldouble ts=Point(); //tick size ,assumed its the native symboldouble SL_size=(OP/100)*SL_p;//open price / 100 , times % ,but thats floaty so ...//find how many "points" are in it ,and that must have no decimal points ,so integerint how_many_tick_sizes=(int)(SL_size/ts);
//and then multiply the tick sizes with the points
SL_size=((double)how_many_tick_sizes)*ts;
//and then normalize it to have the same digits as the Symbol
SL_size=NormalizeDouble(SL_size,d);
//or in short
SL_size=NormalizeDouble(((int)(((OP/100)*SL_p)/ts))*ts,d);
//tp1 in short double TP1_size=NormalizeDouble(((int)(((OP/100)*TP1_p)/ts))*ts,d);
//tp2 in short double TP2_size=NormalizeDouble(((int)(((OP/100)*TP2_p)/ts))*ts,d);
//you can add or remove these according to the order type
I am trying to upload my product but every time these erorrs are come. But in strategy testor no errors and also mql editor no errors . EA is working good in strategy testor.
Requests to execute trade operations are formalized as orders. Each order has a variety of properties for reading. Information on them can be obtained using functions Position identifier that is set to an order as soon as it is executed. Each executed order results in a deal that opens or modifies an already existing position. The identifier of...
If you don't learn MQL4/5, there is no common language for us to communicate. If we tell you what you need, you can't code it. If we give you the code, you don't know how to integrate it into your code.
We're not going to code it for you (although it could happen if you are lucky or the problem is interesting.) We are willing to help you when you post your attempt (using CODE button) and state the nature of your problem. No free help2017.04.21
Hi everyone. I'm looking for a simple (adjustable) Keltner channel or bands indicator where I can get an alert any time price crosses either the upper or lower band - doesn't even need to close over/under, just cross that band/channel.
I promise I've looked EVERYWHERE on the internet to see if it already exists - tried one with an alert but didn't work because the alert was on the center/middle line.
If anyone can point me in the right direction, much appreciation to you!
Allow the use of cookies to log in to the MQL5.com website.
Please enable the necessary setting in your browser, otherwise you will not be able to log in.
You are signed in. Two-factor authentication has been disabled. Set it up again and scan a new QR code, or continue with two-factor authentication disabled.
Heres a calculation example
Hello all
Could any kind soul write this simple indicator for me?
I need an indicator that draws only 2 horizontal lines, one x ticks above and other x ticks below the current previous bar close price.
I would be eternally grateful
It's error 130.
I want to develop very simple EA.
1) All pending order is automatically open with 30 pips interval.
2) 50 pips tp must be on all orders.
3) For each closed order, a new order must be opened at the previous opening level.
I am not programmer , i need codes.
Please help me.
Thank you
what do i do next, i want my robot to buy when indicator> 0 and sell when <0
Don't post pictures of code, they are too hard to read.
Please edit your (original) post and use the CODE button (Alt-S)! (For large amounts of code, attach it.)
General rules and best pratices of the Forum. - General - MQL5 programming forum 2019.05.06
Messages Editor
Help you with what? You haven't stated a problem, you stated a want.
How To Ask Questions The Smart Way. 2004
Prune pointless queries.
You have only four choices:
Search for it. Do you expect us to do your research for you?
MT4: Learn to code it.
MT5: Begin learning to code it.
If you don't learn MQL4/5, there is no common language for us to communicate. If we tell you what you need, you can't code it. If we give you the code, you don't know how to integrate it into your code.
or pay (Freelance) someone to code it. Top of every page is the link Code Base.
Hiring to write script - General - MQL5 programming forum 2019.08.21
We're not going to code it for you (although it could happen if you are lucky or the problem is interesting.) We are willing to help you when you post your attempt (using CODE button) and state the nature of your problem.
No free help 2017.04.21
Hi everyone. I'm looking for a simple (adjustable) Keltner channel or bands indicator where I can get an alert any time price crosses either the upper or lower band - doesn't even need to close over/under, just cross that band/channel.
I promise I've looked EVERYWHERE on the internet to see if it already exists - tried one with an alert but didn't work because the alert was on the center/middle line.
If anyone can point me in the right direction, much appreciation to you!