Jump to content

Looking for EA entering on Pivot R3 and S3 Level


Recommended Posts

Simply trading pivots doesn't work...no matter which level

You have to watch what's happening around the levels and that can't be automated.

If I find the EA I used for testing I'll post it here.

Reaching R3/S3 doesn't have a higher probability for a reversal than the other level

The problem with these extreme levels is that you don't get enough trades in that area to compensate for the high ATR Days where price doesn't care about R3/S3 and just blows through

Link to comment
Share on other sites

you can use this tempalte

 

//+------------------------------------------------------------------+

//| TangoPivotEA.mq4 |

//+------------------------------------------------------------------+

#property copyright "[email protected]"

#property link ""

 

 

extern int Delta1 = 5; // minimalna daljina close prehodnog dana od cppa novog dana

extern int Delta2 = 100; // maximalna -"-

extern double Lot = 0.01;

 

int MagicniBroj=1;

double VrednostPipa;

double AccountEquityPocetni;

double AccountBalancePocetni;

 

int decimala;

int BE=30;

 

 

int init() {

VrednostPipa = VrednostPipa(Symbol());

decimala=MarketInfo(Symbol(),MODE_DIGITS);

AccountEquityPocetni = AccountEquity();

return(0);

}

 

 

//+------------------------------------------------------------------+

//| expert start function |

//+------------------------------------------------------------------+

int start() {

 

if (iVolume(NULL,PERIOD_M15,0)==1) {

BEnaPipa();

}

 

if (iVolume(NULL,PERIOD_D1,0)==1) {

 

double DHigh, DLow, DClose;

double R3,R2,R1,CPP,S1,S2,S3,S4,S5,R4,R5,mr1,ms1;

double TPBuy1,TPBuy2,TPBuy3,TPSell1,TPSell2,TPSell3;

double SLBuy,SLSell;

int ticket;

 

DHigh = iHigh(NULL,PERIOD_D1,1);

DLow = iLow(NULL,PERIOD_D1,1);

DClose = iClose(NULL,PERIOD_D1,1);

 

CPP = NormalizeDouble(((DHigh + DLow + DClose)/3),decimala);

 

if (DayOfWeek()==0 && TimeDayOfWeek(Close[1])==5) { // ako smo u nedelji a prethodna sveca je petak

double H = iHigh(NULL,PERIOD_D1,1);

double L = iLow(NULL,PERIOD_D1,1);

double CLOSE = iClose(NULL,PERIOD_D1,1);

} else if (DayOfWeek()==1 && TimeDayOfWeek(Close[1])==0 && TimeDayOfWeek(Close[2])==5) { // ako smo u ponedeljku a prethodna sveca je nedelja

H = iHigh(NULL,PERIOD_D1,2);

L = iLow(NULL,PERIOD_D1,2);

CLOSE = iClose(NULL,PERIOD_D1,2);

} else { // ostalih dana uzmi prethodni dan

H = iHigh(NULL,PERIOD_D1,1);

L = iLow(NULL,PERIOD_D1,1);

CLOSE = iClose(NULL,PERIOD_D1,1);

}

 

// STANDARD PIVOTS

R1 = (2*CPP)-DLow;

S1 = (2*CPP)-DHigh;

R2 = CPP+(R1-S1);

S2 = CPP-(R1-S1);

R3 = (2.0*CPP) + (DHigh-(2.0*DLow));

S3 = (2.0*CPP) - ((2.0*DHigh)-DLow);

 

mr1 = (R1+CPP)/2;

ms1 = (S1+CPP)/2;

 

TPBuy1=NormalizeDouble(R1,decimala);

TPBuy2=NormalizeDouble(R2,decimala);

TPBuy3=NormalizeDouble(R3,decimala);

TPSell1=NormalizeDouble(S1,decimala);

TPSell2=NormalizeDouble(S2,decimala);

TPSell3=NormalizeDouble(S3,decimala);

 

SLBuy = NormalizeDouble(S1-0*VrednostPipa,decimala);

SLSell = NormalizeDouble(R1+0*VrednostPipa,decimala);

 

BE = MathRound((R2-CPP)/VrednostPipa);

int Isticanje = TimeCurrent()+16*3600; // ima smisla trejd do 16h popodne

 

// na pocetku novog dana redjamo pendinge ako imamo zeljenu razliku izmedju Close i novog CPP, pending stavljamo na cpp racunamo vratice se do njega

if(CPP-DClose>Delta1*VrednostPipa && CPP-DClose<Delta2*VrednostPipa){

ticket = OrderSend(Symbol(),OP_SELLLIMIT, Lot, CPP, 3, SLSell, TPSell1, "",MagicniBroj,Isticanje,Red);

if (AccountBalance()>AccountBalancePocetni) {

ticket = OrderSend(Symbol(),OP_SELLLIMIT, Lot, CPP, 3, SLSell, TPSell2, "",MagicniBroj,Isticanje,Red);

if (AccountBalance()>2*AccountBalancePocetni) {

ticket = OrderSend(Symbol(),OP_SELLLIMIT, Lot, CPP, 3, SLSell, TPSell3, "",MagicniBroj,Isticanje,Red);

}

}

}

 

if(DClose-CPP>Delta1*VrednostPipa && DClose-CPP<Delta2*VrednostPipa){

ticket = OrderSend(Symbol(),OP_BUYLIMIT, Lot, CPP, 3, SLBuy, TPBuy1, "",MagicniBroj,Isticanje,Green);

if (AccountBalance()>AccountBalancePocetni) {

ticket = OrderSend(Symbol(),OP_BUYLIMIT, Lot, CPP, 3, SLBuy, TPBuy2, "",MagicniBroj,Isticanje,Green);

if (AccountBalance()>2*AccountBalancePocetni) {

ticket = OrderSend(Symbol(),OP_BUYLIMIT, Lot, CPP, 3, SLBuy, TPBuy3, "",MagicniBroj,Isticanje,Green);

}

}

}

 

 

 

}

 

}

 

//+------------------------------------------------------------------+

double VrednostPipa(string Par) {

int decimala = MarketInfo(Par,MODE_DIGITS);

if (decimala==2 || decimala==3) double vrednostpipa = 0.01;

if (decimala==4 || decimala==5) vrednostpipa = 0.0001;

return (vrednostpipa);

}

 

void BEnaPipa() {

if (BE>0) {

// ako imamo BR profita, stavljamo na be

for (int i = OrdersTotal() - 1; i >= 0; i--) {

OrderSelect(i, SELECT_BY_POS, MODE_TRADES);

if (OrderSymbol() == Symbol() && OrderMagicNumber() == MagicniBroj) {

if (OrderType() == OP_SELL) {

//Print(OrderTicket()," ",OrderProfit()/OrderLots()/10 ," ",BE," ",OrderLots());

// ako je profit veci od BE i ako je sl iznad open price, stavljamo sl na op

if (OrderProfit()/OrderLots()/10 >= BE && OrderStopLoss() > OrderOpenPrice()) {

OrderModify(OrderTicket(), OrderOpenPrice(), OrderOpenPrice(), OrderTakeProfit(), 0, Red);

}

}

if (OrderType() == OP_BUY) {

// ako je profit veci od BE i ako je sl ispod open price, stavljamo sl na op

if (OrderProfit()/OrderLots()/10 >= BE && OrderStopLoss() < OrderOpenPrice()) {

OrderModify(OrderTicket(), OrderOpenPrice(), OrderOpenPrice(), OrderTakeProfit(), 0, Green);

}

}

}

}

}

}

Link to comment
Share on other sites

or

 

//+------------------------------------------------------------------+

//| Daily Pivot Point Trader.mq4 |

//| Copyright © 2011, Alan R Phillips |

//| http://www.forexfactory.com/showthread.php?t=330992 |

//+------------------------------------------------------------------+

#property copyright "Copyright © 2011, Alan R Phillips"

#property link ""

 

 

extern bool EAOn = false;

extern int TimeZone = 0; //currently doesn't do anything

extern double LotSize = 0.1;

extern int TakeProfitTarget = 0;

 

// 3,2,1 are R3/S3,R2/S2,R1/S1. 0 is no TP

 

 

//+------------------------------------------------------------------+

//| expert initialization function |

//+------------------------------------------------------------------+

int init()

{

//----

 

//----

return(0);

}

//+------------------------------------------------------------------+

//| expert deinitialization function |

//+------------------------------------------------------------------+

int deinit()

{

//----

 

//----

return(0);

}

//+------------------------------------------------------------------+

//| expert start function |

//+------------------------------------------------------------------+

int start()

{

double DHigh, DLow, DClose;

double R3,R2,R1,Pivot,S1,S2,S3;

string EASymbol;

double TPTargetBuy = 0.0;

double TPTargetSell = 0.0;

int ticket;

 

DHigh = NormalizeDouble(iHigh(NULL,PERIOD_D1,1),4);

DLow = NormalizeDouble(iLow(NULL,PERIOD_D1,1),4);

DClose = NormalizeDouble(iClose(NULL,PERIOD_D1,1),4);

 

Pivot = NormalizeDouble(((DHigh + DLow + DClose)/3),4);

R1 = (2*Pivot)-DLow;

S1 = (2*Pivot)-DHigh;

R2 = Pivot+(R1-S1);

S2 = Pivot-(R1-S1);

R3 = ( 2.0 * Pivot) + ( DHigh - ( 2.0 * DLow ) );

S3 = ( 2.0 * Pivot) - ( ( 2.0 * DHigh ) - DLow );

 

EASymbol = Symbol();

 

if(TakeProfitTarget == 0)

{

TPTargetBuy = 0.0;

TPTargetSell = 0.0;

}

if(TakeProfitTarget == 1)

{

TPTargetBuy = R1;

TPTargetSell = S1;

}

if(TakeProfitTarget == 2)

{

TPTargetBuy = R2;

TPTargetSell = S2;

}

if(TakeProfitTarget == 3)

{

TPTargetBuy = R3;

TPTargetSell = S3;

}

if(EAOn == True)

{

if( DClose < Pivot)

{

ticket = OrderSend(EASymbol,3, LotSize, Pivot, 0, R1, TPTargetSell, "Opened by DPP Trader",0,0,Blue);

Print(ticket);

}

if(DClose > Pivot)

{

ticket = OrderSend(EASymbol,2, LotSize, Pivot, 0, S1, TPTargetBuy, "Opened by DPP Trader",0,0,Blue);

Print(ticket);

}

}

else

{

Print("DPP Trader is off.");

}

return(0);

}

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...