MTF RSI GRID Trader

Post Reply
CharlesKiwitrader
Trader
Posts: 54
Joined: Sun Jun 22, 2014 11:01 am

MTF RSI GRID Trader

Post by CharlesKiwitrader »

Hi Coders,
I am hoping someone can help me here as I hope this is something quite simple, that I can't figure out what to change to work how I designed it. I found this EA on this forum as a RSI grid trader and wanted to modify this to a Multi Time Frame RSI Grid Trader, but in modifying I have come unstuck!!! :cry: :cry: :cry:
As the title says I have attempted to create a Multi Time Frame RSI Grid Trader when trades with the trend after the value of the RSI is > 50 (buy) and <50 for sell.

Now the problem is at the moment the EA opens a buy and a sell trade immediately on placing the EA on a chart, or in other words it hedges straight away, and not use the RSI for entry. This makes me think I have done something wrong in my set up of the buy/sell orders etc.

The way I would like this to work is that,
1, when RSI value > 50 the EA would buy only, and if price goes against this it would add buy steps in (already in code), then when RSI < 50 EA would open a sell trade, and continue with hedging from there.

2, There is already in the code a 'profit lock' procedure so when the buy series of trades hits the horizontal line a trailing stop is invisibly placed via dotted line, and the same for collective sell trades.

3. After a buy/sell series has finished the EA would then wait for the MTF RSI value to be either < or > 50 etc for a new series to be placed, as well as the other series still in play (so-to-speak).

Here is hoping someone can help me finish this off so we can test it for profitability etc.

Also, I am attaching a MTF RSI indicator which may provide a useful alternative to what I have inputted, but as a VERY newbie coder I am not keen to add this into the code and correct any mistakes etc if it is an easy job for someone more experienced.
You do not have the required permissions to view the files attached to this post.
Lowphat
Trader
Posts: 121
Joined: Fri Jun 27, 2014 12:20 am

MTF RSI GRID Trader

Post by Lowphat »

I'm not sure if the following code will apply your logic correctly but i took a stab at it.

Code: Select all

bool AllowBuy=false,AllowSell=false;

  if (RSI1>50 && RSI2>50 && RSI3>50 && RSI4>50)AllowBuy=true;
  if (AllowBuy&&buys==0)
      ticket = OrderSendReliable(Symbol(),OP_BUY,CalculateStartingVolume(),MarketInfo(Symbol(),MODE_ASK),slippage,0,0,key,magic,0,Blue);  
or would the above be if (RSI1<50 && RSI2<50 && RSI3<50 && RSI4<50) and then opposite for sells


Code: Select all

 if (buys>=1)
  {    // CASE 1 >>> We reach Stop Loss (grid size)  
    if (total_buy_profit < CalculateSL(total_buy_lots))
        ticket = OrderSendReliable(Symbol(),OP_BUY,MartingaleVolume(total_buy_profit),MarketInfo(Symbol(),MODE_ASK),slippage,0,0,key,magic,0,Blue); 
....

Code: Select all

if (RSI1<50 && RSI2<50 && RSI3<50 && RSI4<50)AllowSell=true;
  if (AllowSell&&sells==0)
     ticket = OrderSendReliable(Symbol(),OP_SELL,CalculateStartingVolume(),MarketInfo(Symbol(),MODE_BID),slippage,0,0,key,magic,0,Red);   

Code: Select all

  if (sells>=1)
  {   // CASE 1 >>> We reach Stop Loss (grid size)   
    if (total_sell_profit < CalculateSL(total_sell_lots))
     ticket = OrderSendReliable(Symbol(),OP_SELL,MartingaleVolume(total_sell_profit),MarketInfo(Symbol(),MODE_BID),slippage,0,0,key,magic,0,Red); 
Post Reply

Return to “Coders Hangout”