UpDn-Alexander Piechotta-30

Profit factor:
2.54

This script is designed to automatically place and manage trades in a financial market, likely forex or stocks, based on a specific technical indicator called "Bulls Power." Here's a breakdown of how it works:

1. Setting the Stage:

  • The script starts by defining several adjustable parameters:
    • TakeProfit: This determines how much profit the script aims to make on each trade, measured in points (a unit of price movement).
    • Lots: This defines the size of the trades the script will make.
    • TrailingStop: This is a safety net that automatically adjusts the stop-loss level as the price moves in a favorable direction, locking in profits.
    • StopLoss: This sets the maximum amount of money the script is willing to lose on a trade.

2. Reading the Market:

  • The script constantly monitors the market using the "Bulls Power" indicator. This indicator is a tool that attempts to gauge the strength of buyers in the market.
  • It looks at the "Bulls Power" value at two different points in time: the previous bar and the current bar.

3. Managing Existing Trades:

  • Closing Losing Positions: If the "Bulls Power" indicates a weakening buying trend (previous Bulls Power is higher than the current) the script first tries to close existing buy orders (hoping to close winning positions using a trailing stop).
  • Closing Winning Positions: Similarly, if the "Bulls Power" suggests a bearish market, the script attempts to close existing sell orders (using trailing stops).

4. Opening New Trades:

  • The script opens new trades only if it doesn't already have an open trade.
  • Selling: If the "Bulls Power" reading suggests weakening buying pressure (previous higher than current) and the current value is above zero, the script will place a sell order.
  • Buying: If the "Bulls Power" indicator shows a negative value, suggesting strong potential for a price increase, the script will place a buy order.

5. Order Execution:

  • When the script decides to open a trade, it sends an order to the trading platform.
  • The order includes:
    • The direction of the trade (buy or sell).
    • The size of the trade (Lots).
    • The stop-loss level (StopLoss).
    • The take-profit level (TakeProfit).

In essence, this script automatically analyzes the market using the "Bulls Power" indicator and places trades based on its readings, aiming to profit from short-term price movements while attempting to limit potential losses.

Orders Execution
Checks for the total of open ordersIt Closes Orders by itself It automatically opens orders when conditions are reached
Indicators Used
Bulls Power indicator
5 Views
0 Downloads
0 Favorites
UpDn-Alexander Piechotta-30
//+------------------------------------------------------------------+
extern double TakeProfit = 7; 
extern double Lots = 0.1; 
extern double TrailingStop = 5; 
extern double StopLoss = 30; 

int start() 
{ 
double pos1pre=0; 
double  pos2cur=0; 
int cnt=0; 
int mode=0; 
double openpozprice=0; 




pos1pre = iBullsPower(NULL,0,1,PRICE_WEIGHTED,1); 
pos2cur = iBullsPower(NULL,0,1,PRICE_WEIGHTED,0); 
//Comment("??????? ???????  ",pos2cur,"Previous pos", pos1pre ); 

if (pos1pre >pos2cur) { 
//????????? ??????? ??????? 

for (cnt=1; cnt<OrdersTotal(); cnt++) 

{ 

OrderSelect(cnt, SELECT_BY_POS, MODE_TRADES); 
        if( OrderSymbol()==Symbol() && OrderType()==OP_BUY ) 


         { 
         if (Bid>(OrderOpenPrice()+TrailingStop*Point)) 
     { 
       OrderClose(OrderTicket(),OrderLots(),Bid,5,Violet); 
     return(0); 
         } 
         } 
  } 
} 


if (pos2cur<0) 
//????????? ???????? ??????? 

{ 

for (cnt=1; cnt<OrdersTotal(); cnt++) 
{ 


OrderSelect(cnt, SELECT_BY_POS, MODE_TRADES); 
      if( OrderSymbol()==Symbol() && OrderType()==OP_SELL ) 
         { 

   if (Ask< (OrderOpenPrice()-TrailingStop*Point)) 
         { 
                    OrderClose(OrderTicket(),OrderLots(),Ask,5,Violet); 
     return(0); 
           }       } 
      } 
} 


if (OrdersTotal() < 1 ) 
{ 

Print("pos1pre = "+pos1pre+"    pos2cur ="+pos2cur); 
if (pos1pre>pos2cur && pos2cur>0)       { 

int ticket=OrderSend(Symbol(),OP_SELL,Lots,Bid,3,0,Bid-TakeProfit*Point,"",0,0,Gold); 
            return(0); 
    } 
   // ????????? ?? ??????????? ?????? ? ??????? ??????? (BUY) 

if (pos2cur<0)   { 
// print("K = "+K+"   S ="+S); 
ticket=OrderSend(Symbol(),OP_BUY,Lots,Ask,3,0,Ask+TakeProfit*Point,"",0,0,Gold); 
    return(0); 
   } 
  } 

} 

Profitability Reports

NZD/USD Oct 2024 - Jan 2025
3.76
Total Trades 258
Won Trades 257
Lost trades 1
Win Rate 99.61 %
Expected payoff 0.51
Gross Profit 179.90
Gross Loss -47.80
Total Net Profit 132.10
-100%
-50%
0%
50%
100%
GBP/USD Oct 2024 - Jan 2025
2.22
Total Trades 398
Won Trades 397
Lost trades 1
Win Rate 99.75 %
Expected payoff 0.38
Gross Profit 277.90
Gross Loss -125.40
Total Net Profit 152.50
-100%
-50%
0%
50%
100%
GBP/CAD Oct 2024 - Jan 2025
0.03
Total Trades 17
Won Trades 0
Lost trades 0
Win Rate 0.00 %
Expected payoff -18.44
Gross Profit 8.09
Gross Loss -321.54
Total Net Profit -313.45
-100%
-50%
0%
50%
100%
AUD/USD Oct 2024 - Jan 2025
4.15
Total Trades 308
Won Trades 0
Lost trades 0
Win Rate 0.00 %
Expected payoff 0.53
Gross Profit 214.90
Gross Loss -51.80
Total Net Profit 163.10
-100%
-50%
0%
50%
100%

Comments