Forum

Sending Double Orders

#include <CustomFunctions010.mqh> int MN = 73 ; int shortmaPeriod = 8 ; int longmaPeriod = 200 ; double maxRiskPerTrade = 0.02 ; double lots = OrderLots(); int orderid; int slippage = 5 ; int OnInit () { Alert ( "" ); Alert ( "The EA just started." ); return ( INIT_SUCCEEDED ); } void

placing new order based off of previous order with OrdersHistoryTotal()

#include <CustomFunctions010.mqh> int MN = 73 ; int shortmaPeriod = 8 ; int longmaPeriod = 200 ; double maxRiskPerTrade = 0.01 ; double lots = OrderLots(); int orderid; int slippage = 10 ; static double longcurrentprice = Close[ 0 ] + ( Point * 40 ); static double shortcurrentprice = Close[ 0 ] - (

Closing Partial Trades

Greetings earthlings, how can I close a partial order such as 1/2 of m y total position after it reaches 1 ATR profit? once the below code triggers it keeps removing half of the position that is left. I was thinking of using my lotsize from the order but i have it as a function that returns the lot

Getting current MA and Close[1] price

Hello, I am having trouble figuring out how to get the EA to use the latest prices to exit a trade once I enter. In the backtester it not only doesn't recognize all possible trades, it exits a trade only when the stop loss is hit. I want to close the trade when the latest Close[1] closes above the

Backtesting- Not recognizing all possible trades & not exiting when it is supposed to

void OnTick () { //--- if (!CheckIfOpenOrdersByMagicNumber(MN)) { while (isNewBar() == true ) { if (High[ 1 ] > High[ 2 ] && Close[ 1 ] < Close[ 2 ])//reversal params { Alert ( "Going short. Reversal Bar." ); double stopLossPrice = High[ 1 ]+ Point ; double

Backtest errors & new bar detection

void OnTick () { //--- if (!CheckIfOpenOrdersByMagicNumber(MN)) { int i = OrdersHistoryTotal(); int a = OrdersHistoryTotal() - 5 ; int b = OrdersHistoryTotal(); for (i = a;i<b;i++) { if ( OrderSelect (i,SELECT_BY_POS,MODE_HISTORY) == true && OrderMagicNumber() == MN

Unmatched data error

How can I fix the Test Generator: Unmatched data error. It is throwing errors for High/Low price

Close trade at the close of current bar.

Hello I am looking to close a trade that i am in for the duration of 1 bar based on the prev 2 bars. if the parameters fit i enter a trade, but when i set my takeprofit to the close of the current bar it will look to execute a close order immediately as it takes the current close price and not the