Greg Pawlak:
Hi, just add new condition "if price close below moving avereage then open position". If this not resolve your problem add screenshot to better describe this case. Regards Greg
Hi greg thanks for the response Hi, just add new condition "if price close below moving avereage then open position". If this not resolve your problem add screenshot to better describe this case. Regards Greg
As you see in the code I attached and the picture i only want trade once above the kijun sen purple line and one trade bellow the line
- 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
Messages Editor -
if(OrdersTotal()<=maxorders){return true;} else return false;
Simplify your code.return OrdersTotal()<=maxorders;
Increase Order after stoploss - MQL4 programming forum № 3 - Using OrdersTotal (or OrdersHistoryTotal) directly and/or no Magic number filtering on your OrderSelect
loop means your code is incompatible with every EA (including itself on other charts and manual trading.)
Symbol Doesn't equal Ordersymbol when another currency is added to another seperate chart . - MQL4 programming forum
MagicNumber: "Magic" Identifier of the Order - MQL4 Articles -
OrderSend(Symbol(), OP_SELL,lots, Ask, 10*10, Bid-StopLoss*Point*10, Bid+TakeProfit*Point*10, "My 1st Order!");
You buy at the Ask and sell at the Bid. So for buy orders you pay the spread on open. For sell orders you pay the spread on close.- Your buy order's TP/SL (or Sell Stop's/Sell Limit's entry) are triggered when the Bid reaches it. Not the Ask. Your SL is shorter by the spread and your TP is longer.
- Your sell order's TP/SL (or Buy Stop's/Buy Limit's entry) will be triggered when the Ask reaches it. To
trigger at a specific
Bid price, add the average spread.
MODE_SPREAD (Paul) - MQL4 programming forum - Page 3 #25 - The charts show Bid prices only. Turn on the Ask line to see how big the spread is (Tools → Options (Control-O) → charts → Show ask line.)
- Check your return codes for errors, and report them including GLE/LE. Don't look at it unless you have an error. Don't just silence the
compiler, it is trying to help you.
What are Function return values ? How do I use them ? - MQL4 programming forum
Common Errors in MQL4 Programs and How to Avoid Them - MQL4 Articles -
if(iClose(Symbol(),0,1)>kijun_sen){ OrderSend( … ); } if(iClose(Symbol(),0,1)<kijun_sen)
When can the second if ever be true?
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
Hi there i have question
UPDATE
i been able to came up with a solution but it seems the strategy tester crash when i uplode the advisor to it , just to keep up with what it is going on this is my attempt to open only one buy order above kijun sen and same thing goes to sell , i think i know the issue which it is infinte loop i guess any clue guys any help will be appreciated, the funny thing is when i replace OP_SELL with OP_BUY the tester work just fine //but the logic and idea will be invalid and one more thing it worked much less orders but still i need only one order per side view attached pictures