Hi Everyone. Im trying to develop a expert to use on crash500 market, The aim is for it to open a sell order once the RSI is on 90 and then open a second and a 3rd order about 4 candle sticks after the first order was placed. Basically the first order to open when RSI is on 90 then open a second order when RSI reaches 92 and a third order once RSI reaches 94. I managed to get it to open on RSI90 but now im not sure how to create for the other two orders to open. Is there anyone who can please tell me where I went wrong or who can assist.I would also like to add a trailing stop so that when the order is in profit it should close after about 3 minutes or 3 1minute candles on crash500. Please advise on what I can do. Also how do I get it so that the input will show once I load the expert in order for me to change the lot size and the SL and TP
#include <Trade\Trade.mqh>
CTrade trade;
voidOnTick()
{
// create an empty Stringstring enrty ="";
// Get the Ask pricedouble Ask=NormalizeDouble(SymbolInfoDouble(_Symbol,SYMBOL_ASK),_Digits);
// Get the Bid pricedouble Bid=NormalizeDouble(SymbolInfoDouble(_Symbol,SYMBOL_BID),_Digits);
// create an Array for several pricesdouble myMovingAverageArray17[],myMovingAverageArray80[];
//define the properties of the Moving Averageint movingAverageDefinition1 = iMA (_Symbol,_Period,17,0,MODE_EMA,PRICE_CLOSE);
// define the properties of the Moving Average2int movingAverageDefinition2 = iMA (_Symbol,_Period,80,0,MODE_EMA,PRICE_CLOSE);
// sort the price array1 from current candle downwardsArraySetAsSeries(myMovingAverageArray17,true);
// sort the price array2 from the currant candle downwardsArraySetAsSeries(myMovingAverageArray80,true);
// Define MA1, one line, current candle,3 candles, store resultsCopyBuffer(movingAverageDefinition1,0,0,3,myMovingAverageArray17);
// Define MA2, one line, current candle,3 candles, store resultsCopyBuffer(movingAverageDefinition2,0,0,3,myMovingAverageArray80);
if ( // Check if the 17 candle EA is above the 80 candle EA
(myMovingAverageArray17[0]>myMovingAverageArray80[0])
&& (myMovingAverageArray17[1]<myMovingAverageArray80[1])
)
{
entry="buy";
}
if ( // Check if the 80 candle EA is above the 20 candle EA
(myMovingAverageArray17[0]<myMovingAverageArray80[0])
&& (myMovingAverageArray17[1]>myMovingAverageArray80[1])
)
{
entry=="sell";
}
// sell 20 Mikrolotif (entry =="sell" && PositionsTotal()<1)
trade.Sell(0.20,NULL,Bid,0,(Bid-150 * _Point),NULL);
if (entry =="buy" && PositionsTotal()<1)
// buy 20 Microlot
trade.Buy(0.20,NULL,Ask,0, (Ask+150 * _Point),NULL);
Allow the use of cookies to log in to the MQL5.com website.
Please enable the necessary setting in your browser, otherwise you will not be able to log in.
You are signed in. Two-factor authentication has been disabled. Set it up again and scan a new QR code, or continue with two-factor authentication disabled.
Hi Everyone. Im trying to develop a expert to use on crash500 market, The aim is for it to open a sell order once the RSI is on 90 and then open a second and a 3rd order about 4 candle sticks after the first order was placed. Basically the first order to open when RSI is on 90 then open a second order when RSI reaches 92 and a third order once RSI reaches 94. I managed to get it to open on RSI90 but now im not sure how to create for the other two orders to open. Is there anyone who can please tell me where I went wrong or who can assist.I would also like to add a trailing stop so that when the order is in profit it should close after about 3 minutes or 3 1minute candles on crash500. Please advise on what I can do. Also how do I get it so that the input will show once I load the expert in order for me to change the lot size and the SL and TP