I need a function writing to evaluate the last order placed after it has reached it's take profit or stop loss, writing the profit/loss to a global variable and also return a Boolean value of 0/1 depending on a profit or loss being generated. My orders always run to stop limits or take profits.
This sounds easy enough, although I have hit a stumbling block with HistorySelect and cannot go any further, the problem is as follows - I have a structure on tick that looks a little like this:
void OnTick()
{
if(PositionsTotal() >= 1)
{
}
else
{
RefreshCharts();
CalculateProfitAndLoss();
OpenOrder();
}
}
Now the problem is, that my OpenOrder() function may fail and the OnTick() function will loop again when the market refreshes and as a result, the CaculateProfitLoss() function), sees the previous unsuccessful trade and reports a zero profit/loss, which isn't correct.
The solution is probably glaringly obvious, but I cannot work it out and want to get on with the technical analysis side of things.
Let me know what you think. I would have written a full specification, but with no inputs and only two outputs, it didn't seem worth it.
Only stipulation is that code is heavily documented.
Additional note (added 06/Sep/13): I just want to ensure that people have read the above thoroughly and understand that simple code such as that listed below does not achieve the desired results as I have a lot of failed trades opening, a situation I am attempting to resolve with a new function. Example of what doesn't work:
last_deal=HistoryDealGetTicket((int)deals-1);
Pedidos semelhantes
Hello The EA will work on particular zone choose by the user and can mark it on any TF and with some rules can open trades and mange the trade by some unique rules. the EA need to check the difference by RSI as well and with some extra rules . developer should have good attitude and good communication (englsih) with high performence and knowledge with coding EA
Hi, Thanks for looking at my requirement. Here are the details of the job(MT4) and right now, we do have 2 jobs to do in same file. The clear detailed explanation along with the pictures are in the google drive link : https://drive.google.com/drive/folders/14KMGzunkE-Hbg0eK6iUrs4DNvRetTJYc?usp=sharing Also, i am into this coding thing for more than 2 years now full time. I am a math guy and not a coder. So the
Hi, Thanks for looking at my requirement. Here are the details of the job and right now, we do have 2 jobs to do in same file. The clear detailed explanation along with the pictures are in the google drive link : https://drive.google.com/drive/folders/14KMGzunkE-Hbg0eK6iUrs4DNvRetTJYc?usp=sharing Also, i am into this coding thing for more than 2 years now full time. I am a math guy and not a coder. So the
i want a robot and an indicator that uses macd..bolingerbands And emas As well as fibonacci retracement confirmation from SMC strategy , OB+CHoCH And RTO i want it to print SL and TP using High and Lows
Hello, I need an expert that can help me to develop an EA. That can also work while I open trade on phone, can I get this done? I need video demo and work sample. Thanks
Скальпер по стакану ( фронтраннинг ) : Рассчитывает средний обьем ордеров в пределах N уровней цены от текущей цены , и ставит свой ордер на покупку/продажу перед ордером который на X % больше средней цены N уровней . Стоп лосс и тейк профит всегда заданы по умолчанию из настроек ( фиксированные ) . В случае если ордер перед которым мы ставили свой ордер перестает соответствовать условиям то мы свой ордер снимаем
We have an existing EA which use specific strategy based on our propriety Indicator(Semaphores) and Stochastic. The EA is multi symbol and Multi timeframe. we need to fix it for following issues 1 - Check the Status on close of the Candle[1] or open of the Candle[0] 2 - open order with SL which meet specific requirement 3 - Amend order for TP when specific requirement meet. 4 - Update the Scanner as in the picture. 5
I am looking for an experienced developer to help me create a simple EA. EA requirements are as follows: 1. EA needs to check if a trade is open based on magic number entered in EA settings by the user. 2. If matching magic number trade is open, then EA should do the following: a. If the magic number trade closes with TP. then monitor again for magic number trade to open.. b. If the magic number trade closes with SL
I want to create an EA MT5 that can 1. identify support and resistance (based on close candles) 2. mark snr breakout 3. multitimeframe breakout scanner 4. scan the valid setup that appears 5. available for manual marking, INFO SPREAD & TIME NEXT BAR 6. sends alert notification to Telegram I need a professional and experienced developer with fast and good work according to what I want. if you are interested I will
I wanted to have existing EA or develop new one just to place pending orders according to according to signals received ( buy stop or sell stop ) from the indicator