Orders Execution
Checks for the total of open ordersIt automatically opens orders when conditions are reachedIt Closes Orders by itself It can change open orders parameters, due to possible stepping strategy
Indicators Used
Stochastic oscillator
0 Views
0 Downloads
0 Favorites

Profitability Reports

AUD/USD Oct 2024 - Jan 2025
1.00 %
Total Trades 4
Won Trades 0
Lost trades 0
Win Rate 0.00 %
Expected payoff -2099.82
Gross Profit 78.00
Gross Loss -8477.30
Total Net Profit -8399.30
-100%
-50%
0%
50%
100%
GBP/USD Oct 2024 - Jan 2025
0.00 %
Total Trades 2
Won Trades 1
Lost trades 1
Win Rate 0.50 %
Expected payoff -4480.45
Gross Profit 26.00
Gross Loss -8986.90
Total Net Profit -8960.90
-100%
-50%
0%
50%
100%
StoXAM
//+------------------------------------------------------------------+ 
//|                                                       StoXAM.mq4 | 
//|                                  Copyright © 2006, Pavel Izhutov | 
//|                                        e-mail: izhutov@yandex.ru | 
//+------------------------------------------------------------------+ 
extern double TakeProfit = 20; 
extern double Lots = 0.1; 
extern double TrailingStop = 30; 
extern double StopLoss = 20;    
extern double MR = 0.02; 
extern double DF = 3; 
double Optimization(){ 
double lot=Lots; 
int    orders=HistoryTotal();      
int    losses=0;                  
lot=NormalizeDouble(AccountFreeMargin()*MR/150.0,1); 
if(DF>0){for(int i=orders-1;i>=0;i--){ 
if(OrderSelect(i,SELECT_BY_POS,MODE_HISTORY)==false) { Print("Error in history!"); break; } 
if(OrderSymbol()!=Symbol() || OrderType()>OP_SELL) continue; 
if(OrderProfit()>0) break; 
if(OrderProfit()<0) losses++;} 
if(losses>1) lot=NormalizeDouble(lot-lot*losses/DF,1);} 
if(lot<0.1) lot=0.1;return(lot);} 
double Points; 
int init (){ 
Points = MarketInfo (Symbol(), MODE_POINT);return(0);} 
int deinit(){return(0);} 
int start(){ 
int cnt=0, total; 
if(Bars<10){return(0);}  
if(TakeProfit<20){return(0);} 
if(OrdersTotal()>1){return(0);} 
if(Hour()>23 || Hour ()<1){return(0);} 
if(OrdersTotal()<1){    
if(AccountFreeMargin()<(1000*Lots)){return(0);} 
if(iStochastic(Symbol(),0,5,5,3,MODE_SMA,0,MODE_MAIN,0)>iStochastic(NULL,0,5,5,3,MODE_SMA,0,MODE_SIGNAL,0)){OrderSend(Symbol(),OP_SELL,Optimization(),Bid,3,0,Bid-TakeProfit*Points,"I like Rammsteine and Stochastic",16384,0,Red); 
if(GetLastError()==0)Print("Order opened : ",OrderOpenPrice());return(0);}    
if(iStochastic(Symbol(),0,5,5,3,MODE_SMA,0,MODE_MAIN,0)<iStochastic(NULL,0,5,5,3,MODE_SMA,0,MODE_SIGNAL,0)){OrderSend(Symbol(),OP_BUY,Optimization(),Ask,3,0,Ask+TakeProfit*Points,"I like Rammsteine and Stochastic",16384,0,Red); 
if(GetLastError()==0)Print("Order opened : ",OrderOpenPrice());return(0);}return(0);} total=OrdersTotal();for(cnt=0;cnt<total;cnt++){OrderSelect(cnt, SELECT_BY_POS, MODE_TRADES); 
if(OrderType()<=OP_SELL && OrderSymbol()==Symbol()){ 
if(OrderType()==OP_BUY){ 
if(iStochastic(Symbol(),0,5,5,3,MODE_SMA,0,MODE_MAIN,0)>iStochastic(NULL,0,5,5,3,MODE_SMA,0,MODE_SIGNAL,0)){OrderClose(OrderTicket(),OrderLots(),Ask,3,Violet);return(0);} 
if(TrailingStop>0){      
if((OrderOpenPrice()-Ask)>(Points*TrailingStop)){ 
if(OrderStopLoss()==0.0 || OrderStopLoss()>(Ask+Points*TrailingStop)){OrderModify(OrderTicket(),OrderOpenPrice(),Ask+Points*TrailingStop,OrderTakeProfit(),0,Red);return(0);}}}}else{ 
if(iStochastic(Symbol(),0,5,5,3,MODE_SMA,0,MODE_MAIN,0)<iStochastic(NULL,0,5,5,3,MODE_SMA,0,MODE_SIGNAL,0)){OrderClose(OrderTicket(),OrderLots(),Ask,3,Violet);return(0);} 
if(TrailingStop>0){  
if(Bid-OrderOpenPrice()>Points*TrailingStop){ 
if(OrderStopLoss()<Bid-Points*TrailingStop){OrderModify(OrderTicket(),OrderOpenPrice(),Bid-Points*TrailingStop,OrderTakeProfit(),0,Red);return(0);}}}}}}return(0);}

Comments

Markdown supported. Formatting help

Markdown Formatting Guide

Element Markdown Syntax
Heading # H1
## H2
### H3
Bold **bold text**
Italic *italicized text*
Link [title](https://www.example.com)
Image ![alt text](image.jpg)
Code `code`
Code Block ```
code block
```
Quote > blockquote
Unordered List - Item 1
- Item 2
Ordered List 1. First item
2. Second item
Horizontal Rule ---