Forex Zone - Forex Forum

EA Code

Discussion started on EA Modifications

  • Jr. Member
  • Posts: 69
  • Points: 0
  • Likes Received: 4
  • Reputation: +0/-0

thank you for giving me the ea code, hopefully it will be useful ... for more updates
 
#31 - February 11, 2019, 09:23:06 AM

  • Starter
  • Posts: 1
  • Points: 0
  • Likes Received: 0
  • Reputation: +0/-0

thank you very much for help


I don't which section to post this in. Hopefully this is the right one.
I am busy coding an EA (with my limited knowledge ;))
Here is one issue I can't seem to solve, obviously it works perfectly with the EA running on only 1 currency pair, but as soon as I drop it on another pair, I run into the following problems, I know it's just a stupid coding mistake on my side:
-------------------
I have set the maximum trades to 1, so it doesn't open
more than 1 buy or 1 sell.
This works fine, but if I drop the EA on a 2nd pair, it doesn't take trades, unless I change the 2nd MagicNumber to something different.
This is not a real issue, as I can just assign a new magic number to every currency pair. It would just be nice if I don't need 5 different magic numbers for the same EA on 5 pairs

The big issue I have is partial take profit.
It works fine on 1 pair, closes perfectly, BUT if I drop on pair number 2, it uses the 1st next tick to calculate the value the 2nd pair's value, and obviously it uses the wrong pair's value to partly close the other pair.


Code: [Select]
//  add your notes here ...
if ( ( Use_Partial_TP == true ))
{
SellPTP=OrderOpenPrice()-(Partial_TP* Point);
if ( ( OrderLots() == Lots ) || ( OrderLots() == _MMLots ))
{
if ( ( Ask <= SellPTP ))
{
for( int pos6030=0;pos6030<OrdersTotal();pos6030++)
{
if(OrderSelect(pos6030,SELECT_BY_POS)==false) continue;
if( ( OrderTicket() == _OrderTicketEA) )
{
double price6198=0;

price6198 = MarketInfo(OrderSymbol(), MODE_ASK);

_fnCloseSellPTP = OrderClose(  OrderTicket(), (OrderLots()/2), price6198, Slippage, White );
if( _fnCloseSellPTP == false )
Print("OrderClose error=", GetLastError());


Coding for buy is basically the same except Add to the open price, and close price is Bid, etc etc.
And it does this besides the fact that the same EA runs on both pairs, but different magic numbers, which is why I am totally stumped, I was under the impression if I assign different magics, it will solve this problem too.

Thanks for the help again.
Francois


#32 - February 11, 2019, 05:26:20 PM

  • Hero Member
  • Posts: 742
  • Points: 338
  • Likes Received: 55
  • Reputation: +3/-6
if you do not use the magic number on EA means that EA must read the symbol pair that is being traded this is used so that the reading of all orders can be separated from one pair to another
#33 - February 12, 2019, 12:52:01 PM

  • Sr. Member
  • Posts: 424
  • Points: 18
  • Likes Received: 39
  • Reputation: +0/-0
if you do not use the magic number on EA means that EA must read the symbol pair that is being traded this is used so that the reading of all orders can be separated from one pair to another
whether EA can also read all the symbols so that the results can be added together and from the total results if it is positive, it can close all
#34 - April 24, 2019, 02:36:47 AM

  • Hero Member
  • Posts: 742
  • Points: 338
  • Likes Received: 55
  • Reputation: +3/-6
whether EA can also read all the symbols so that the results can be added together and from the total results if it is positive, it can close all
can be contrived as you wish, but all that must be seen in full coding
#35 - April 24, 2019, 11:47:43 PM

  • Newbie
  • Posts: 47
  • Points: 0
  • Likes Received: 0
  • Reputation: +0/-0
can be contrived as you wish, but all that must be seen in full coding
has it become EA
#36 - June 20, 2019, 05:45:10 AM

  • Hero Member
  • Posts: 742
  • Points: 338
  • Likes Received: 55
  • Reputation: +3/-6
#37 - June 21, 2019, 02:33:20 AM

  • Newbie
  • Posts: 47
  • Points: 0
  • Likes Received: 0
  • Reputation: +0/-0
NOT YET
if so, let's wait together here
#38 - June 28, 2019, 03:28:06 PM

  • Hero Member
  • Posts: 742
  • Points: 338
  • Likes Received: 55
  • Reputation: +3/-6
if so, let's wait together here
yes, be patient
#39 - July 02, 2019, 11:01:29 AM

  • Newbie
  • Posts: 36
  • Points: 0
  • Likes Received: 0
  • Reputation: +0/-0
yes, be patient
hope you will be patient
#40 - July 04, 2019, 08:41:34 AM

  • Newbie
  • Posts: 47
  • Points: 0
  • Likes Received: 0
  • Reputation: +0/-0
yes, be patient
what if you try it yourself
#41 - July 04, 2019, 01:05:19 PM

  • Newbie
  • Posts: 10
  • Points: 0
  • Likes Received: 0
  • Reputation: +0/-0
can you help me..make an ea?
#42 - August 12, 2019, 06:25:31 AM

Members:

0 Members and 2 Guests are viewing this topic.