I need help with an MQL4 question:

thread: I need help with an MQL4 question:

  1. #1

    I need help with an MQL4 question:

    Hey there, my name's Brandon. I am co-developer at a new EA that's some great potential, but we are having a bit of trouble with a few order time. And we are banging our heads against the wall trying to figure out it. Here's the question in a nut shell:

    I want a buy to close along with a sell to close, and a BuyStop to start at the identical time. How can I put price of the stop order, SL of the sale order and TP of the buy order they close at the same time? In another direction, I would like a sell and buy order to close, and a SellStop. So how can I set the SellStop price, SL of the buy and TP of the sell such they close at the same time?

    I understand I want to add/subtract distribute, but on/at that prices?

    If you have any advice that may help us we would very much love it! You can also download an early version of the software that you try at this website:
    http://www.meetup.com/profitable-pips

    Thank you for your time!

    Brandon

  2. #2
    Member Nighy's Avatar
    42
    Then it needs to be done , if a thing is to be discussed by people here. Try not to direct visitors to elsewhere. I believe it's against forum rules.

    What you've supplied is not enough detail. When would you like the buy and sell trade to close and open up a BuyStop? When would it be a SellStop? Are they based on the same currency pair? If you say open a BuyStop or SellStop, do you mean placing the pending order or the pending order was place, you would like it to execute to a Buy or market order.

    ***Removed***

  3. #3
    Except if sending them into the site is against rules. I guess that I could have uploaded a copy of the EA on here, and let people click that if I had thought about it. If I did I didn't mean to cause a problem!

    Also thank you for your response, I will get back with my spouse (the one who knows how to write MQL4) and see exactly what he sais.

    Take care!

    Brandon

  4. #4
    If spread was not involved that would work. Spread needs to be added or subtracted for the open orders to along with the cease order to become live all at precisely the identical time. But I don't know how to take action.
    Mike

  5. #5
    Member Nighy's Avatar
    42
    Okay then let me revise my bills

    1. The Buy order's TP is the Sell order's SL-Spread
    2. The Buy order's SL is the Sell order's TP-Spread
    3. The BuyStop Opening price is the Buy order's TP Spread
    4. The SellStop Opening price is the Sell order's TP-Spread

    Ask is always higher than Bid. Difference is the spread.

    We consistently Buy in the Ask and Sell in the Bid
    we shut a Buy order in the Bid and we shut a Sell order in the Ask
    just knowing this connection, we could work out were to minus and where to plus spread.

    Stage 1 and 2 could be re-written as

    1. The Sell order's TP is the Buy order's SL Spread
    2. The Sell order's SL is the Buy order's TP Spread

    regards,
    Zen

  6. #6
    Thank You for the Answer.

    If I were to use your rules, I would have the following given the initial order is put first, second order is placed second, both buy/sell orders close at the exact same time as the very best order is started (about the exact same pair)? ...

    Assumptions:
    Ask = 100
    Bid = 99.98
    Distribute = 0.02

    Order Price SL TP
    Buy 100.00 99.00 100.50
    Economy 99.50 100.52 99.02
    BS 100.52 99.52 101.02

    - -
    Economy 99.98 100.98 99.48
    Buy 100.48 99.46 100.96
    SS 99.46 100.46 98.96

    Please correct me where I'm wrong.
    Thanks,
    Mike

  7. #7
    Member Nighy's Avatar
    42
    I believe so. And that is assuming your broker doesn't widen spread.

  •