Posts: 2
Please rate this topic Current rating: 0 Votes: 0
RSS
Hemanth Kumar
Hemanth Kumar
Free Member
Offline
  • Registered: 12-13-17
  • Posts: 1
  • Age: 2024
  • Email
  • Thanks: 1

PSAR - (Tested with over $3,100,000 profit)

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

#property copyright     "Luca Spinello - mql4tradingautomation.com"
#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(){         
   RefreshRates();
   ePoint=Point;
   Slip=Slippage;
   if (MathMod(Digits,2)==1){
      ePoint*=10;
      Slip*=10;
   }
   TP=TakeProfit*ePoint;
   SL=StopLoss*ePoint;
   CanOrder=TradeEnabled;
   CanOpenBuy=true;
   CanOpenSell=true;
}


//Check if orders can be submitted
void CheckCanOrder(){           
   if( Bars      Print("INFO - Not enough Bars to trade");
      CanOrder=false;
   }
   OrdersOpen();
   return;
}


//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());
         break;
      }
      if( OrderSymbol()==Symbol() && OrderType() == OP_BUY) CanOpenBuy=false;
      if( OrderSymbol()==Symbol() && OrderType() == OP_SELL) CanOpenSell=false;
   }
   return;
}


//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());
         break;
      }
      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);
            if(res){
               Print("TRADE - CLOSE - Order ",Ticket," closed at price ",ClosePrice);
               break;
            }
            else Print("ERROR - CLOSE - error closing order ",Ticket," return error: ",GetLastError());
         }
      }
   }
   return;
}


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


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


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


//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());
         continue;
      }
     
      //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
      RefreshRates();
      if(OrderType()==OP_BUY){
         if(PSARPrice>StopLossPrice && PSARPrice<Close[1] && PSARPrice<TakeProfitPrice){
            NewStopLossPrice=NormalizeDouble(PSARPrice,Digits);
         }
      }
      if(OrderType()==OP_SELL){
         if(PSARPriceClose[1] && PSARPrice>TakeProfitPrice){
            NewStopLossPrice=NormalizeDouble(PSARPrice,Digits);
         }
      }
     
      //If the new Stop Loss and Take Profit Levels are different from the previous then I try to update the order
      if(NewStopLossPrice!=StopLossPrice){
         Print("Modifying order ",OrderTicket()," Open Price ",OpenPrice," New Stop Loss ",NewStopLossPrice," New Take Profit ",NewTakeProfitPrice);
         if(OrderModify(OrderTicket(),OpenPrice,NewStopLossPrice,NewTakeProfitPrice,0,Yellow)){
            Print("Order modified");
         }
         else{
            Print("Order failed to update with error - ",GetLastError());
         }     
     
      }

   
   }
}




//+------------------------------------------------------------------+
//| Expert initialization function                                   |
//+------------------------------------------------------------------+
int OnInit()
  {
//---
   
//---
   return(INIT_SUCCEEDED);
  }
//+------------------------------------------------------------------+
//| Expert deinitialization function                                 |
//+------------------------------------------------------------------+
void OnDeinit(const int reason)
  {
//---
   
  }
//+------------------------------------------------------------------+
//| Expert tick function                                             |
//+------------------------------------------------------------------+
void OnTick()
  {
//---
   //Calling initialization, checks and technical analysis
   Initialize();
   CheckCanOrder();
   UpdatePositions();
   CheckPSARCross();
   //Check of Entry/Exit signal with operations to perform
   if(CrossToOpenBuy){
      CloseAll(OP_SELL);
      if(CanOpenBuy && CanOrder) OpenNew(OP_BUY);
   }
   if(CrossToOpenSell){
      CloseAll(OP_BUY);
      if(CanOpenSell && CanOrder) OpenNew(OP_SELL);
   }
  }
//+------------------------------------------------------------------+

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

Thanked for the post: jozmik

What's new on MT4talk?

NEW! Daily MT4talk Artificial Intelligence (AI) Forex signals for manual trading.

It's simple! Receive the daily MT4talk AI Forex signals from MT4talk, then execute your trades, establish the recommended Take Profit (TP) and Stop Loss (SL), and relax. Your tasks for the day are complete.

The MT4talk AI Forex Signal works perfectly. See the latest earnings from MT4talk signal users.

We believe that the results of Forex signal users are the best way to demonstrate proof of profit.

MT4Talk Signal - 2023.12.05 - 3.10 profit
My today winning with the MT4talk AI Forex Signal 05.12.2023
MT4talk Forex AI Signal - EurUsd Sell Signal. Profit: $19.68
MT4Talk Signal - 2023.12.01 - 12.44% profit
Incredible AI Signals! 2023.12.01
I've made 30%+ today. 2023.12.01
Bad day today, only a 14.36% profit overall. :)
Profit from MT4Talk Signal - 2023.11.30

View past trading results by MT4talk PRO members...

MT4talk EA Tester
Lifetime PRO - Unlimited Download Access
Offline
  • From: Ukraine
  • Registered: 09-08-18
  • Posts: 897
  • Gender: male
  • Age: 41
  • Email
  • Thanks: 181

Hi, thanks for sharing.

I updated this EA and I added an automatic lot size manager, which automatically grows the trading lot size as the trading balance is growing. Each time the robot makes a profit its starts trading with a bigger lot size. The profit talks for itself!

I made a lot of changes and tested this Forex robot on a real STP account!

Please look at what I got.

We tested on: FXOpen Broker!

IMPORTANT! Use the below button to open an FXOpen wallet to get leverage up to 500!
WARNING! If you are not using the below button to open a new FXOpen wallet, then you may not get leverage up to 500!

img/p/fxopen.png

If you are using this Forex robot on any other forex broker, then you may have to find your own settings, because provided settings not working with all brokers.

We tested on super-fast Forex VPS! It's highly recommended for 24/5 automated trading!

img/vps.png

Deposit: $500
Leverage: 1:500
The test time: 3 months.
Total trades: 49
Average trades per month: 16
Total profit: $3,180,360

I tested on the real account!

img/m/25379/5f03bbb86b3ec4.60416935.gif

Note: We made this test for you, to give you a starting point. You should always make your own test.


Have a good trend and the biggest profit!

For detailed test information, please download the files below!

ea-psar v1.0 mod1.ex4 29.6 kb, 138 downloads since 2020-07-07 
gu m30 d500 p3.1M ea-par v1.0 mod1.htm 37.61 kb, 135 downloads since 2020-07-07 
gu m30 d500 p3.1M ea-par v1.0 mod1.set 1.35 kb, 126 downloads since 2020-07-07 
User's signature

- We are testing robots on FBS Forex broker!
- We are testing robots on FXOpen accounts!
- We are testing robots on LQDFX accounts!

Last Forum Posts
  • 10/12: The new MT4talk.com Trend Detector & Pip Hunter Forex Robot!
  • 10/12: How do you manage risk and avoid emotianal trading?
  • 10/12: Small Account, Which Timeframes Best for Forex?
  • 10/12: How to add screenshots see the screenshots to the forum posts?
  • 10/12: Learning Forex Trading Without Spending a Penny?
  • 09/12: Ilan 1.4: Visual Backtest with $200, 0.1 Lots
  • 09/12: Eye-Opening Insights on Forex Trading - Plus More!
  • 08/12: Small Drawdown, Big Gains: Charles-1.3.3 EA in Action
  • 08/12: Boost Your Trading: Ilan1.4 EA Optimization Tips Inside!
  • 08/12: Tailoring Orders: A Comprehensive Look at e-PSI@ManagerTrailing_v.2.5
  • 08/12: ForexFactory EA: Optimize for Best Pairs! Grider.ex4
  • 08/12: Enhanced Daily Open Strategy: Download Now!
  • 08/12: Unleashing OCTA SUPER EA: Swing, Scalp, News!
  • 08/12: Optimal Arbitrage EA Suggestions
  • 08/12: Navigating Forex: The Holy Grail EA for Real Gains
  • 08/12: how to pay tax for forex trading and how much?
  • 08/12: Profit Hunter EA - It's a super scalper EA!
  • 08/12: Moving Average Convergence Divergence (MACD): A Beginner`s Guide
  • 08/12: Basic Concepts VI: Types of Orders
  • 08/12: Basic Concepts III: History and Recent Trend of Online FX Market
  • 08/12: Top Scalping EAs: Share Your Picks!
  • 08/12: Scalper v5 + Wicks EA Inquiry - Any Recommendations?
  • 08/12: Effortless Profits: EA Blessing Configuration
  • 08/12: Enhance Your Strategy with Multi-StrategyiFSF EA: Expert Tips Inside!
  • 08/12: FX Safe Profit: Steady Income with Unique Trading Tech!
  • 08/12: Feedback Wanted: FXAlarms_14.12 EA Trial
  • 08/12: TFOT 3.0-EDU: Boosting Performance with Open Price
  • 08/12: USDJPY Sell, 8th December +33.96 USD
  • 07/12: XMT-Scalper v.2.46: Error-Free Operation – Seeking Guidance
  • 07/12: Basic Concepts II: Nature of the Foreign Exchange Market
  • 07/12: Basic Concepts I: Introduction
  • 07/12: Pips or points?
  • 07/12: Profitable Hedge EA: Optimal for Trending Currencies & Indices
  • 07/12: Proteção de EA: Bloqueio com Número de Conta
  • 07/12: Seeking Robust EA: Minimize Drawdown, Optimize Risk
  • 07/12: Seeking 24/7 Holy Grail EA: Low DD, $2K Start
  • 07/12: What's the most challenging part of Forex trading?
  • 07/12: Super pumped to be here!
  • 06/12: AI Signals 06.12.23 -1,68% profit despite difficult market conditions
  • 06/12: MT4Talk Signal - 2023.12.06 - 4.90$ profit
  • 06/12: Seeking Profitable VSA-Based EA
  • 06/12: VSA by the master the market e-book indicator
  • 06/12: Adaptive scalper - Inquiry
  • 06/12: Top Scalper: Consistent Profits for All Traders
  • 06/12: Daily Scalping: 100 Pips, Any Timeframe, Green Pips Guaranteed!
  • 06/12: Tick Scalper v3.4: Optimal for Fixed Accounts, 5min/15min TF
  • 06/12: ole$ya-PRO EA V.1
  • 06/12: In Search of Modified Martingale EA: Download Recommendations?
  • 06/12: safe martingale EA
  • 06/12: AIS2 Trading Robot: Auto Trading & Risk Control
  • 06/12: ibfx - Quick Buy: Powerful Forex EA for LQDFX and FXOpen
  • 06/12: zigzag1.mq4 Forex indicator download
  • 05/12: MT4Talk Signal - 2023.12.05 - 3.10 profit
  • 05/12: My today winning with the MT4talk AI Forex Signal 05.12.2023
  • 05/12: MT4talk Forex AI Signal - EurUsd Sell Signal. Profit: $19.68
  • 05/12: EU sell, 05.12. Profit: 27.40
  • 05/12: ilan1.4 (timefilter).mq4 - Proven Forex Robot for LQDFX and FXOpen
  • 05/12: EA Profit V11 Backtest - Unveiling Trading Efficiency
  • 05/12: Unlock Trading Success: Forex Indicator Predictor v2.0 Revealed
  • 05/12: Trend Signal Arrows: Master Your Buying and Selling
  • 05/12: Forex Millionaire Expert Advisor - Ideal for Any Market Condition
  • 05/12: Profitable EA: Download Super Robot Martin Now!
  • 05/12: Optimizing Robots for Live Profits: Stop and Target Tips?
  • 05/12: Pulp Fiction EA - Profit Unleashed: Pulp Fiction.ex4 Magic!
  • 05/12: Seeking Binary Option Indicator: Need Recommendations!
  • 05/12: EA Success: RONGGOLAWE - $2K Start, Pepperstone Razor, 5 Trades Max
  • 05/12: Maximize Gains, Minimize Risks with EA Fozzy
  • 05/12: Best EA for Arbitrage Trading?
  • 05/12: Trade-Arbitrage.mq4 - Powerful Forex EA for Consistent Profits
  • 04/12: Dragon Expert FF: 97% Gain, Default Settings
  • 04/12: Is Forex Trading on MT4 Right for Beginners? Tips and Strategies.
  • 04/12: How Can You Maximize Profits with Advanced Strategies in MT4 Trading?
  • 04/12: Exness Trading: Safe Deposits, Smooth Trading, No Instant Withdrawals?
  • 04/12: PZ Goldfinch EA: Tested for Success, Ending in Profits!
  • 04/12: What Are the Best Indicators for Forex Success?
  • Backtested Forex Robots & Setting Files
  • 08/01: Forex Cash Robot - (tested with over $1,100,000 profit)
  • 08/09: GRAVITY EA - (tested with over $14,000 (14,000%) profit)
  • 12/11: multi_lot_scalper.mq4 Forex EA - (tested with over $500,000 profit)
  • 14/06: EA MTF sar_rsi mod2 - (Tested with over $150,000 profit)
  • 05/09: StepMAExpert_v1.42 EA - (tested with over $1,000,000 profit)
  • 19/12: macd sampleimproved Forex EA - (tested with over $2,200,000 profit)
  • 06/03: MA Reverse Ea for Mt4 - (Tested with over $1,500,000 profit)
  • 18/08: 2019 Crisis Scalper - Automated Forex robot - Tested with $3M+ profit
  • 16/03: Genie - (Tested with over $110,000 (4,400%) profit)
  • 25/04: EMA CROSS - (Tested with over $1,700,000 profit)
  • 21/02: EA - (tested with over 1,600% ($6,700) profit)
  • 15/02: EUREKA V7.2 - (tested with over 5,200% profit)
  • 14/05: Ma_angle_ea.mq4 Forex EA - (Tested with over $1,000,000 profit)
  • 07/06: ma_angle_eav2 free Forex EA - (Tested with over $2,000,000 profit)
  • 02/12: breakout_1.1_daytrade_eurm1.mq4 - (Tested with over $470,000 profit)
  • 27/12: Money bag - forex robot - (Tested with over $22,000,000 profit)
  • 14/07: Chaostrader - (Tested with over $1,600,000 profit)
  • 25/10: Bollinger Breakout EURUSD M15 - (tested with over $2.6M profit)
  • 03/04: 5M SCALP.mq4 Forex free EA - (Tested with over $500,000 profit)
  • 05/02: 6ema_8ema.mq4 free Forex EA - (Tested with over $5,200,000 profit)
  • 05/03: Hangseng Trader EA - (Tested with over $1,800,000 profit)
  • 21/02: _MAvsMA_ema - (Tested with over $4,800,000 profit)
  • 30/03: macd sample 5 digit.mq4Forex - (Tested with over $2,000,000 profit)
  • 08/07: farhadcrab1.mq4 Free Forex EA - (Tested with over $1,000,000 profit)
  • 28/03: juanita_0.1lotsea - (Tested with over $130,000 (27,000%) profit)

  • NOTE: You can only share open-source Forex robots on this platform. Sharing hacked or unauthorized versions of copyrighted Forex robots is strictly prohibited and can result in a ban on your account.

    By using the MT4talk website, you automatically agree to the Forum Rules & Terms of Use, as well as the terms below.

    Everything you see on the MT4talk website is created by its users, mainly the members of the MT4talk forum. The website doesn't sell Forex robots and doesn't provide support for the ones you download. MT4talk only offers a PRO membership, allowing you to download unlimited files from forum posts. Updates for the Forex robots may be limited or nonexistent, depending on the creator. If you choose to download any Forex robot or setting file from the forum, you acknowledge that you are using it at your own risk. MT4talk PRO membership is a digital product. Therefore, after you complete the PRO membership purchase, there is no refund available!


    We are conducting real-life tests on Forex robots to assess their performance. For certain robots, we may use a demo account to conduct tests, and for other Forex robots, we may use a real Forex account. It's essential to recognize that we are not financial advisors and cannot provide investment guidance. Our objective is to discover effective market analysis solutions through testing various strategies, which could be beneficial to our community.


    CFTC RULE 4.41 – HYPOTHETICAL OR SIMULATED PERFORMANCE RESULTS HAVE CERTAIN LIMITATIONS. UNLIKE AN ACTUAL PERFORMANCE RECORD, SIMULATED RESULTS DO NOT REPRESENT ACTUAL TRADING. ALSO, SINCE THE TRADES HAVE NOT BEEN EXECUTED, THE RESULTS MAY HAVE UNDER-OR-OVER COMPENSATED FOR THE IMPACT, IF ANY, OF CERTAIN MARKET FACTORS, SUCH AS LACK OF LIQUIDITY. SIMULATED TRADING PROGRAMS, IN GENERAL, ARE ALSO SUBJECT TO THE FACT THAT THEY ARE DESIGNED WITH THE BENEFIT OF HINDSIGHT. NO REPRESENTATION IS BEING MADE THAT ANY ACCOUNT WILL OR IS LIKELY TO ACHIEVE PROFIT OR LOSSES SIMILAR TO THOSE SHOWN.

    Disclaimer - No representation is being made that any Forex account will or is likely to achieve profits or losses similar to those shown on backtests in this forum. In fact, there are frequently sharp differences between hypothetical performance results and the actual results subsequently achieved by any particular trading program. Hypothetical trading does not involve financial risk, and no hypothetical trading record can completely account for the impact of financial risk in actual trading. All information on this forum is for educational purposes only and is not intended to provide financial advice. Any statements posted by forum members or the MT4talk EA Tester Team about profits or income expressed or implied, do not represent a guarantee. Your actual trading may result in losses as no trading system is guaranteed. You accept full responsibilities for your actions, trades, profit or loss, and agree to hold the MT4talk team and forum members of this information harmless in any and all ways.


    Affiliates Disclaimer - The website may have links to partner websites, and if you sign up and trade through these links, we will receive a commission. Our affiliate partners are FXOpen, FBS, LQDFX, and MyForexVPS.


    Site map forums - Sitemap posts - Sitemap public search - Sitemap topics - Sitemap user posts - Sitemap user topics - Sitemap users

    Copyright MT4talk.com Forum Rules - Privacy Policy.