You didn't post a topic yet. Let us show you how to make your first topic and upload your favorite forex robot. Guide me

Skip to forum content

Quick Login / Register with Facebook Account!

Login with Facebook

Login with Username and Password!

     Username:       Password:  Login

Register  |  Forgot Password?


The latest topics with attached files (Forex robots, Forex Indicators, etc..)

Forums in this category with details of Replies, Views, last post

Renko EMA Robot v9.1

by caballoblanc


by Wynand Nel

Pages 1

You must login or register to post a reply


Posts: 2
Please rate this topic
Current rating: 0
Votes: 0

Embed topic to your site


Topic: PSAR

//|                                                 EA-PSAR_v1-0.mq4 |
//|                                                    Luca Spinello |

#property copyright     "Luca Spinello -"
#property version       "1.00"
#property strict
#property description   "This Expert Advisor opens orders when the PSAR changes from above to below the price or vice versa"
#property description   " "
#property description   "DISCLAIMER: This code comes with no guarantee, you can use it at your own risk"
#property description   "We recommend to test it first on a Demo Account"

ENTRY BUY: PSAR changes from above the previous bar to below the current bar
ENTRY SELL: PSAR changes from below the previous bar to above the current bar
EXIT: Take profit or trailing stop using PSAR

extern double LotSize=0.1;             //Position size

extern double StopLoss=20;             //Stop loss in pips
extern double TakeProfit=500;          //Take profit in pips

extern int Slippage=2;                 //Slippage in pips

extern bool TradeEnabled=true;         //Enable trade

extern double PSARStep=0.2;            //PSAR Step         
extern double PSARMaxStep=0.02;        //PSAR Max Step

extern int MagicNumber=11223344;       //Magic Number to assign to the orders

//Functional variables
double ePoint;                         //Point normalized

bool CanOrder;                         //Check for risk management
bool CanOpenBuy;                       //Flag if there are buy orders open
bool CanOpenSell;                      //Flag if there are sell orders open

int OrderOpRetry=10;                   //Number of attempts to perform a trade operation
int SleepSecs=3;                       //Seconds to sleep if can't order
int MinBars=60;                        //Minimum bars in the graph to enable trading

//Functional variables to determine prices
double MinSL;
double MaxSL;
double TP;
double SL;
double Spread;
int Slip; 

//Variable initialization function
void Initialize(){          
   if (MathMod(Digits,2)==1){

//Check if orders can be submitted
void CheckCanOrder(){            
   if( Bars<MinBars ){
      Print("INFO - Not enough Bars to trade");

//Check if there are open orders and what type
void OrdersOpen(){
   for( int i = 0 ; i < OrdersTotal() ; i++ ) {
      if( OrderSelect( i, SELECT_BY_POS, MODE_TRADES ) == false ) {
         Print("ERROR - Unable to select the order - ",GetLastError());
      if( OrderSymbol()==Symbol() && OrderType() == OP_BUY) CanOpenBuy=false;
      if( OrderSymbol()==Symbol() && OrderType() == OP_SELL) CanOpenSell=false;

//Close all the orders of a specific type and current symbol
void CloseAll(int Command){
   double ClosePrice=0;
   for( int i = 0 ; i < OrdersTotal() ; i++ ) {
      if( OrderSelect( i, SELECT_BY_POS, MODE_TRADES ) == false ) {
         Print("ERROR - Unable to select the order - ",GetLastError());
      if( OrderSymbol()==Symbol() && OrderType()==Command) {
         if(Command==OP_BUY) ClosePrice=Bid;
         if(Command==OP_SELL) ClosePrice=Ask;
         double Lots=OrderLots();
         int Ticket=OrderTicket();
         for(int j=1; j<OrderOpRetry; j++){
            bool res=OrderClose(Ticket,Lots,ClosePrice,Slip,Red);
               Print("TRADE - CLOSE - Order ",Ticket," closed at price ",ClosePrice);
            else Print("ERROR - CLOSE - error closing order ",Ticket," return error: ",GetLastError());

//Open new order of a given type
void OpenNew(int Command){
   double OpenPrice=0;
   double SLPrice;
   double TPPrice;
   for(int i=1; i<OrderOpRetry; i++){
      int res=OrderSend(Symbol(),Command,LotSize,OpenPrice,Slip,NormalizeDouble(SLPrice,Digits),NormalizeDouble(TPPrice,Digits),"",MagicNumber,0,Green);
         Print("TRADE - NEW - Order ",res," submitted: Command ",Command," Volume ",LotSize," Open ",OpenPrice," Slippage ",Slip," Stop ",SLPrice," Take ",TPPrice);
      else Print("ERROR - NEW - error sending order, return error: ",GetLastError());

//Technical analysis of the indicators
bool CrossToOpenBuy=false;
bool CrossToOpenSell=false;

void CheckPSARCross(){
   double PSARCurr=iSAR(Symbol(),0,PSARStep,PSARMaxStep,0);
   double PSARPrev=iSAR(Symbol(),0,PSARStep,PSARMaxStep,1);
   if(PSARCurr<Close[0] && PSARPrev>Close[1]){
   if(PSARCurr>Close[0] && PSARPrev<Close[1]){

//Trailing Stop with PSAR
void UpdatePositions(){

   //Scan the open orders backwards
   for(int i=OrdersTotal()-1; i>=0; i--){
      //Select the order, if not selected print the error and continue with the next index
      if( OrderSelect( i, SELECT_BY_POS, MODE_TRADES ) == false ) {
         Print("ERROR - Unable to select the order - ",GetLastError());
      //Check if the order can be modified matching the criteria, if criteria not matched skip to the next
      if(OrderSymbol()!=Symbol()) continue;
      if(OrderMagicNumber()!=MagicNumber) continue;
      //Prepare the prices
      double TakeProfitPrice=OrderTakeProfit();
      double StopLossPrice=OrderStopLoss();
      double OpenPrice=OrderOpenPrice();
      double NewStopLossPrice=StopLossPrice;
      double NewTakeProfitPrice=TakeProfitPrice;
      //PSAR Value of the current symbol, current time frame , PSARStep, PSARMaxStep, previous candle
      double PSARPrice=iSAR(Symbol(),0,PSARStep,PSARMaxStep,1);
      //Get updated prices and calculate the new Stop Loss and Take Profit levels, these depends on the type of order
         if(PSARPrice>StopLossPrice && PSARPrice<Close[1] && PSARPrice<TakeProfitPrice){
         if(PSARPrice<StopLossPrice && PSARPrice>Close[1] && PSARPrice>TakeProfitPrice){
      //If the new Stop Loss and Take Profit Levels are different from the previous then I try to update the order
         Print("Modifying order ",OrderTicket()," Open Price ",OpenPrice," New Stop Loss ",NewStopLossPrice," New Take Profit ",NewTakeProfitPrice);
            Print("Order modified");
            Print("Order failed to update with error - ",GetLastError());


//| Expert initialization function                                   |
int OnInit()
//| Expert deinitialization function                                 |
void OnDeinit(const int reason)
//| Expert tick function                                             |
void OnTick()
   //Calling initialization, checks and technical analysis
   //Check of Entry/Exit signal with operations to perform
      if(CanOpenBuy && CanOrder) OpenNew(OP_BUY);
      if(CanOpenSell && CanOrder) OpenNew(OP_SELL);

Post's attachments

EA-PSAR_v1-0.ex4 15.2 kb, 37 downloads since 2017-12-13 

Recommended by forum Admin:

Try this EA on leverage 1:3000. All Forex strategies allowed! Scalping, hedging, martingale, etc...  Deposit small money and make a big profit!

IMPORTANT: If you are using a Forex robot, you must use a very fast Forex VPS! Try this super fast Forex VPS!


Thanked for the post: jozmik


li will check this, thank you very much, i have some eas, i will post here, thank you for all information, see you later, thank you very much


Posts: 2

Pages 1

You must login or register to post a reply

Very Hot Topics

EA with a profit $2,159.52

EA with a profit $1,945.43

Last Posts

  • 19/10: Someone has experience with : Megadroid 1.41?
  • 19/10: MT4 platform
  • 19/10: Sophia EA on FBS - New settings - $1000 standard or $10 cent account!
  • 19/10: mini trading account
  • 18/10: Best settings for the EA Sophia. I withdraw over $20,000 / month.
  • 18/10: Chamara sampath EA - MQ4 file (expert advisor)
  • 17/10: ASSARV11
  • 17/10: Sophia EA on FBS - New settings - Total net profit $2159.52
  • 16/10: thrilled to work in the forex
  • 15/10: Thor EA
  • 15/10: Blessing
  • 15/10: This EA still works and able to make very big weekly profit.
  • 15/10: Sophia Best Version EA + Set file for FBS! - Profit $194,459.50
  • 14/10: Renko EMA Robot v9.1
  • 14/10: brokerage houses
  • 13/10: EA Sniper JS - MQ4 file (expert advisor)
  • 13/10: Deal with your emotions
  • 13/10: US Cent Account
  • 13/10: Broker has to be chosen after all inspection
  • 13/10: BSS Full EA
  • Hot Topics

  • ASSAR v8 (1047)
  • Scalper_v5 (free) (720)
  • A highly profitable Ea (463)
  • FX Magic Robot - Verified Live Working 3/13/17 (458)
  • 2000 pips daily (455)
  • ASSAR V9 (Trend Breakout Edition) 2017 Expert Advisor (417)
  • spartan bolt V6 (414)
  • Assar_03_EA (387)
  • Forex Earth Robot (249)
  • Trade-Arbitrage EA (248)
  • xmt scalper (227)
  • Forex Math EA free for Mt4 (180)
  • Super Signal Scalping Profit Statement (178)
  • Rabbit3 £100 start Zero to Hero Updated EA (168)
  • Fracture 7.4.0 (156)
  • high profit EA (151)
  • SCALPER PALING JOSS EA is a Holy Grail (150)
  • New to forex? (148)
  • Ilan Expert Advisor for Metatrader 4 (136)

  • NOTE: Hacked or illegal versions of copyrighted Forex robots are highly prohibited on If you upload any illegal version of any copyrighted Forex robot, your forum account will be banned. No exceptions.


    Forex Risk Warning: Due to leverage, Forex comes with a high risk of losing money. Eighty to 90 percent of Forex traders lose money. You should not invest money that you cannot afford to lose.

    Forum statistics

    • Total number of registered users: 23,852
    • Newest registered user: Asep Ahmad
    • Total number of topics: 11,305
    • Total number of posts: 37,079

    Online users: 1,945 guests, 127 Members:

    123mzo, 2899973350, achstar02, admin, aevan3318, alisn7031, am53investing, amala3247, amaralphp, amdpc93, aprice220466, arthurbraga, Asep Ahmad, athomson999, axel7969, azersami, Bandeauman Gjc RG, Bizz Byg, bobzee04, Cas, Cavendish, Cesar Rio, ChasingDragons, chris1961GR, clubsmanpro, cosmarchy, Cretu Vasile, cruelzhang, csampath1992612, d3nix111, danieltito1964, Daraku, dogsbody, DomCount12, Donovan Sissing, Dream_, dvorynen, Eakapun, Eiki Uchida, elassar08, enginemix, Forexfollower, forexgirona, Forum Admin, francorocca1970, freezyabe, fridgefx, grahay, gustavoxblive, hondacbrr6, honvohermann, Hukman, ian.kungu, Iboma Charles, ismaelbado, jerrydeng, jhane600, joebattle, Jordan Pritchett, Jose Garcia, José Luis Pérez, judeekatherinexx, Juliana A Gomes, Karol Plichta, kean2xl, Kyen Tan Kee Han, leandrobfurtado01, Leandroleri, leitzb, logu5332, machs_nochmal, Makari, marinho7, mazharfxtrading, mehmoodkhan0332, miar02, millonar7, mountaincjm, mroracle, mt4talk, mwachii, Nestor Rivas, nicholaswilliams123, Nur Hidayat, nyisa61, ohaneze, osagiemoney, Rain Forest, reboatmoney, Ricardo Joseph, robertpierce, rochellebrown30, scalley48, serctes, Serwar7896, shahbaz.star333, Shahzad Amin, shatter_sh0t, soldado777, sonykp2008, spittlegiles, sporty, Stefanov Stancho Ivanov, sultan501, sunganidon, sunwin, tai, Take Sige, tfeller, Thuy Mai Van, Tim Reigel, tmandava, Tom Kuhn, topcat275, tradenak, tsuwahas2017, tuvix2, ueuktfd, Valie, Verapan Ruampatanakit, Victoriano, Vincentius Chris, vtc.chau, why, Yai Megaforce, younes700, zangar


    Copyright Forum Rules - Privacy Policy.