AccountEquity vs. AccountBalance EA or Code?
Results 1 to 9 of 39

Thread: AccountEquity vs. AccountBalance EA or Code?

  1. #1
    Does anybody know of an EA that can automatically and immediately send market orders to CLOSE ALL rankings IF AccountEquity drops under a percentage of AccountBalance and/or if AccountEquity climbs above a percentage of AccountBalance?

    I think this could be useful for a multiple positions management egy rather than trading with tough working stops or take profits or along with open stops and takeprofits.

    I figure what I am looking for is a EA that has been coded and could be substituted. Or, the part of code that will Close all positions (which I think is the harder part to code with multiple positions).

    Anyone know if this kind of thing?

  2. #2
    Did you spot the deliberate mistake?

    It is one of my first efforts from when I started to learn.
    I will make adjustments to the CloseAllOrders function and repost
    It will still work though, but will only shut 1 order each tick

  3. #3

  4. #4
    Thanks, I'll check it out later this weekend.

    I'm thinking about analyzing exits predied on equity /instead of having open stops and TPs. It's a pet peeve of mine once the market trades nearby stop or tp levels, I do not want everyone to see them, in precisely the exact same time, I don't want a static price pattern of /- pips of TP/SL. Other than having variable TP/SLs based on algorithmic movement, I'm thinking it may be intriguing to some PA EAs to depart based on equity.

  5. #5
    Quote Originally Posted by ;
    Thanks, I'll check it out after this weekend. I am considering analyzing exits based on equity /- instead of getting open ceases and TPs. It's a pet peeve of mine when the market trades near halt or tp amounts, I don't want anyone to view them, at precisely the exact same time, I don't want a static price pattern of /- pips of TP/SL. Other than having variable TP/SLs based on algorithmic movement, I am thinking it may be interesting to some PA EAs to exit based on equity.
    It might be useful when trading correlated pairs at a reduced risk per trade.

  6. #6
    Fantastic morning @ all,

    I'm looking for an EA such as Gumrai did post . I, however, would like it with a concret profit/loss - parameter. By way of instance, close all places when 300$ profit is reached (TP), close all places when 150$ adverse is reached (SL). The version of gumrai works with a percentage of account balance.
    I have been googeling around, but a lot of the time that the EA's use percent of equity or using a lot of fancy stuff, a couldn't loe this simple but helpful instrument.

    Does anyone have such little tool and may discuss this, or may change an existing one to this?

    Thank you for your time...

    Chriss

  7. #7
    Quote Originally Posted by ;
    Good Day @ all, I am looking for an EA such as Gumrai did article . But I would like it with a concret profit/loss - parameter. For example, close all places when 300$ profit is attained (TP), close all of places when 150$ negative is attained (SL). Gumrai's variant works with % of account balance. I've been googeling around, but most of the time that the EA's work with percent of equity or using a lot of fancy things, a couldn't loe this easy but helpful instrument. Does anyone have such little tool and can discuss it, or may change an existing one for this? ...
    Me ,

    I found you, this instrument has an aditional function, it is possible to group you're trades: https://www.forexsoutheast.asia/cryp...s-working.html

    I will test this one with my following trades...

    Regards

    Chriss

  8. #8
    This case closes all pending and open orders when equity is $200 less balance. Easy to edit to whatever logic you'd like to setup. Notice there's a 3 second sleep in between closing orders. Maybe this is to prevent order closing issues. You can try lower numbers (0.5-2 minutes ), but I have not tested that.

    Place this at the top of the mq4 document:
    Inserted Code extern int milligr = some_mgic_number;
    Put this in launch () or OnTick():
    Inserted Code if ((AccountBalance()-AccountEquity()) gt; 200 ) EndSession(); return(0); Place this at the bottom of the mq4 document:

    Inserted Code bool EndSession() // This closes ALL orders int cnto,complete =OrdersTotal(),dummy; for(cnto=0;cntolt;complete;cnto ) Sleep(3000); dummy = OrderSelect(cnto,SELECT_BY_POS,MODE_TRADES); should (OrderSymbol()==Symbol() OrderMagicNumber()==mg) if(OrderType()gt;1) dummy = OrderDelete(OrderTicket()); if(OrderType()==OP_BUY) dummy = OrderClose(OrderTicket(),OrderLots(),Bid,3); if(OrderType()==OP_SELL) dummy = OrderClose(OrderTicket(),OrderLots(),Ask,3); return(true);
    Disclaimer; Advice supplied with no warranties or warranties of Any Sort.
    Credit; EndSession partially comes from mgridEA, from somewhere else on this forum.

  9. #9
    Quote Originally Posted by ;
    Does anybody know of an EA that can automatically and immediately send market orders to CLOSE ALL positions IF AccountEquity drops under a proportion of AccountBalance and/or if AccountEquity rises above a proportion of AccountBalance? I think this could be useful for a multiple positions management egy instead of trading with hard working stops or take profits or along with open ceases and takeprofits. I guess what I am searching for is a EA that's been coded and could be substituted. Or, the portion of code that will Close all positions (which...
    Something that you tweak with

    EDIT - removed attachment - will upload later.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
This website uses cookies
We use cookies to store session information to facilitate remembering your login information, to allow you to save website preferences, to personalise content and ads, to provide social media features and to analyse our traffic. We also share information about your use of our site with our social media, advertising and analytics partners.