Aggressive Step Trading
- Asesores Expertos
- Chia Leilypour
- Versión: 1.0
//+------------------------------------------------------------------+
//| RSICascade.mq5
//| Copyright 2024, MetaQuotes Ltd. |
/ /| http s://www.mql5.com
//+------------------------------------------------------------------+
#property copyright "Copyright 2024, MetaQuotes Ltd."
#property link "https://www.mql5.com"
#property version "1.00"
#include <Clases_más_comunes.mqh>
double lotSize;
int RSIShift_current = 0;
int RSIShift_Previous = 1;
bool suficiente_dinero;
bool valor_suficiente;
string mensaje;
bool IsBuy;
bool TradeIsOk;
double StopLoss
double TakeProfit
double Refference_MA;
double Current_RSI
double Previous_RSI;
input double PorcentajeDeRiesgo=0,01;
input double R2R=2;
input double StopLossPoints=400;
input double MinimumStopLossPoints=100;
input int RSIPeriod = 7;
input int RSI_LowerLimit=30;
input int RSI_HigherLimit=70;
ST_StopLoss_TakeProfit arr;
void OnTester()
{
}
void OnTick()
{
double ask = NormalizeDouble(SymbolInfoDouble(_Symbol, SYMBOL_ASK), _Digits);
double bid = NormalizeDouble(SymbolInfoDouble(_Symbol, SYMBOL_BID), _Digits);
Current_RSI=RSICalculator(_Symbol,PERIOD_CURRENT,RSIPeriod,RSIShift_current);
Previous_RSI=RSICalculator(_Symbol,PERIOD_CURRENT,RSIPeriod,RSIShift_Previous);
Refference_MA= MACalculator(_Símbolo,PERIOD_D1,30,1,MODE_SMA,PRICE_CLOSE);
if(IsNewCanddle(PERIOD_H1))
{
TradeIsOk=true;
//if(PositionsTotal() != 0)canddleCount=canddleCount+1;
}
if(Current_RSI>RSI_LowerLimit && Previous_RSI<RSI_LowerLimit && SymbolOpenOrders(Symbol())==0 && TradeIsOk && ask>Refference_MA)
{
StopLoss=pregunta-PuntosStopLoss*Punto();
//lotSize=OptimumLotSize(_Symbol,ask,StopLoss,RiskPercent);
lotSize=0.01;
dinero_suficiente =CheckMoneyForTrade(Symbol(),lotSize,ORDER_TYPE_BUY);
enough_valume=CheckVolumeValue(lotSize,mensaje);
TakeProfit=precio+R2R*PuntosStopLoss*Punto();
if(enough_money && enough_valume)Trading.Buy(lotSize, NULL, ask, StopLoss,0, "Logic Order");
IsBuy=true;
}
if(Current_RSI<RSI_HigherLimit && Previous_RSI>RSI_HigherLimit && SymbolOpenOrders(Symbol())==0 && TradeIsOk && bid<Refference_MA)
{
StopLoss=bid+StopLossPoints*Punto();
//lotSize=OptimumLotSize(_Symbol,ask,StopLoss,RiskPercent);
lotSize=0.01;
dinero_suficiente =CheckMoneyForTrade(Symbol(),lotSize,ORDER_TYPE_SELL);
enough_valume=CheckVolumeValue(lotSize,mensaje);
TakeProfit=bid-R2R*StopLossPoints*Punto();
if(enough_money && enough_valume) Trading.Sell(lotSize, NULL, bid, StopLoss,0, "Logic Order");
IsBuy=false;
}
if(TradeIsOk && SymbolOpenOrders(Symbol())>=1)
{
//arr=Cascade_trading(_Symbol,lotSize,IsBuy,ask,bid,TakeProfit,StopLoss,StopLossPoints,MinimumStopLossPoints,R2R,true, SymbolOpenOrders(Symbol()));
//TakeProfit=arr.NewTakeProfit;
//StopLoss=arr.NewStopLoss;
}
}

