NotesWhat is notes.io?

Notes brand slogan

Notes - notes.io

//+------------------------------------------------------------------+
//| break_out.mq4 |
//| Copyright 2017, Charly Oudy. |
//+------------------------------------------------------------------+
#property copyright "2017, Charly Oudy."
#property description "Break Out"

#define MAGICNUM 20131111

// Define our Parameters
input double Lots = 0.03;
input int TakeProfit = 450; // The take profit level (0 disable)
input int StopLoss = 200; // The default stop loss (0 disable)

//+------------------------------------------------------------------+
//| expert initialization functions |
//+------------------------------------------------------------------+
int init()
{
return(0);
}
int deinit()
{
return(0);
}

//+------------------------------------------------------------------+
//| On calcule le nombre de positions ouvertes sur cette paire |
//+------------------------------------------------------------------+
int Nb_Positions(){
int total=OrdersTotal();
int count = 0;
int pos;

// On itere chaque transaction ouvertes

if (total==0){
return total;
}

for(pos=0;pos<total;pos++) {
if(OrderSelect(pos,SELECT_BY_POS) == false) continue;
if (OrderSymbol() != Symbol()) continue;
count++;
}

// Maintenant on renvoie le nombre d'ordres ouverts
return count;
}

//+---------------------------------------------------------------------------+
//| Si la bougie 1 est 3x plus grande que la bougie 2 |
//+---------------------------------------------------------------------------+
int detectBougie(){
double bougieUn = Close[1] - Open[1];
double troisBbougieDeux = 3*(Close[2] - Open[2]);

if (MathAbs(bougieUn) >= MathAbs(troisBbougieDeux))
{
if (bougieUn > 0){
return 1; // Signal d'achat
}
else{
return 2; // Signal de vente
}
}
else{
return 0; // Aucune action
}
}

//+------------------------------------------------------------------+
//+ On démarre le stupide robot |
//+------------------------------------------------------------------+
int start()
{
int typeOrdre = detectBougie(); // On détecte le signal d'achat ou non

if (typeOrdre > 0){ // Si on a un ordre d'achat


int positionsOuvertes=Nb_Positions(); // On vérifie si une position est ouverte

// On ouvre le trade que si on a pas de trade en cours
if(positionsOuvertes<1)
{
int ticket;
double ShortSL, ShortTP, LongSL, LongTP;

// Calculate Stop Loss and Take profit
if(StopLoss > 0){
ShortSL = Bid+(StopLoss*Point);
LongSL = Ask-(StopLoss*Point);
}
if(TakeProfit > 0){
ShortTP = Bid-(TakeProfit*Point);
LongTP = Ask+(TakeProfit*Point);
}

// Placement d'ordre
if (typeOrdre == 1){ // ACHAT
ticket = OrderSend(Symbol(), OP_BUY, Lots,Ask,5, LongSL, LongTP, "Break-Out Achat",MAGICNUM,0,Blue);}
else{ // VENTE
ticket = OrderSend(Symbol(), OP_BUY, Lots,Bid,5, ShortSL, ShortTP, "Break-Out Vente",MAGICNUM,0,Blue);}

// On vérifie et on affiche le résultat
if (ticket > 0){
if(OrderSelect(ticket, SELECT_BY_TICKET, MODE_TRADES)){
Print("BUY Order Opened: ", OrderOpenPrice(), " SL:", LongSL, " TP: ", LongTP);
}
else{
Print("Error Opening BUY Order: ", GetLastError());
return(0);
}
}
}
}

return(0);
}
     
 
what is notes.io
 

Notes is a web-based application for online taking notes. You can take your notes and share with others people. If you like taking long notes, notes.io is designed for you. To date, over 8,000,000,000+ notes created and continuing...

With notes.io;

  • * You can take a note from anywhere and any device with internet connection.
  • * You can share the notes in social platforms (YouTube, Facebook, Twitter, instagram etc.).
  • * You can quickly share your contents without website, blog and e-mail.
  • * You don't need to create any Account to share a note. As you wish you can use quick, easy and best shortened notes with sms, websites, e-mail, or messaging services (WhatsApp, iMessage, Telegram, Signal).
  • * Notes.io has fabulous infrastructure design for a short link and allows you to share the note as an easy and understandable link.

Fast: Notes.io is built for speed and performance. You can take a notes quickly and browse your archive.

Easy: Notes.io doesn’t require installation. Just write and share note!

Short: Notes.io’s url just 8 character. You’ll get shorten link of your note when you want to share. (Ex: notes.io/q )

Free: Notes.io works for 14 years and has been free since the day it was started.


You immediately create your first note and start sharing with the ones you wish. If you want to contact us, you can use the following communication channels;


Email: [email protected]

Twitter: http://twitter.com/notesio

Instagram: http://instagram.com/notes.io

Facebook: http://facebook.com/notesio



Regards;
Notes.io Team

     
 
Shortened Note Link
 
 
Looding Image
 
     
 
Long File
 
 

For written notes was greater than 18KB Unable to shorten.

To be smaller than 18KB, please organize your notes, or sign in.