• Home
  • Forums
  • News
  • Calendar
  • Coins
  • Market
  • Login
  • Join
  • User/Email: Password:
  • 9:30pm
Menu
  • Forums
  • News
  • Calendar
  • Coins
  • Market
  • Login
  • Join
  • 9:30pm
Sister Sites
  • Metals Mine
  • Energy EXCH
  • Forex Factory

Options

Bookmark Thread

First Page First Unread Last Page Last Post

Print Thread

Similar Threads

50 Lots and Up (Your Experience Trading Large Lots) 3 replies

EA to close a percentage of lots per trade 13 replies

Lots and Positions Size as a Percentage 14 replies

Is there a script that open trades by percentage? 4 replies

Open 4 trades for 4 lots or 1 trade for 4 lots? 5 replies

  • Platform Tech
  • /
  • Reply to Thread
  • Subscribe
  • 142
Attachments: Useful Script for Open Order with Percentage Profit and Lots
Exit Attachments

Useful Script for Open Order with Percentage Profit and Lots

  • Last Post
  •  
  • Page 1 234 5
  • Page 1 234 5
  •  
  • Post #1
  • Quote
  • First Post: Edited Jul 7, 2020 5:17am Jun 30, 2018 8:07am | Edited Jul 7, 2020 5:17am
  •  penyuperwira
  • Joined Aug 2017 | Status: Member | 110 Posts
Hi Everyone , I just wanted to share my open order script.
Please inform me any errors or bugs you have found.

I have used Real XM micro account for testing.
It might not compatible for other account and other broker but the code can be modify easily as I have included *.mq4 files.

There are 4 folders in the zip files...
1. CloseAndBreakevenLayer - not my own code, but I included it as it's useful
2. OpenManyLayer - this is mine
3. OpenOneLayer - this is mine
4. OpenOneLayerAndModifyOtherLayer - this is mine

I hope the folder name is understood easily by you as the name it self is what the script is suggesting to do...
I will not explain in detail further what the script does...
it is best if you test it in demo account first to understand what it does.

All the script is set by default to used Money Management (MM) Settings.
Which is to setup trade base on percentage risk lots and percentage take profit of the current account balance and equity.
As your account balance and equity grow, the real Lots also increase and real Profit in dollar $ also increase.
S/L Stoploss is disable by default.

I also made a button on chart to simplify one click trade operation
latest version EA ButtonTrading V2.11 download LINK (July 7, 2020)
latest version EA ButtonTrading V2.08 download LINK (May 11, 2020)
latest version EA ButtonTrading V2.06 download LINK (May 9, 2020)
latest version EA ButtonTrading V2.07 download LINK (May 6, 2020)
latest version EA ButtonTrading V2.05 download LINK (Apr 18, 2020)
latest version EA ButtonTrading V3 download LINK (Apr 13, 2020)
latest version EA ButtonTrading V2.04 download LINK (Apr 11, 2020)
latest version EA ButtonTrading V2.03 download LINK (Dec 5, 2018)

Attached Image
Attached Image


My current favorite script that I uses for trade now is below...

For Up Trend
[email protected] (open a buy trade and set all trade T/P=profit % , clear S/L=0)
[email protected] (open a sell trade and set all trade sell S/L == T/P (trade buy) , and clear trade sell T/P=0)
version 4 open opposite trade and will resulted trade sell in loss and trade buy in profit and exited at the same time.
[email protected] (open a buy trade and set all trade sell S/L == T/P (trade buy) , and clear trade sell T/P=0)
version 5 will resulted trade sell in loss and trade buy in profit and exited at the same time.

For Down Trend
[email protected] (open a sell trade and set all trade T/P=profit % , clear S/L=0)
[email protected] (open a buy trade and set all trade buy S/L == T/P (trade sell) , and clear trade buy T/P=0)
version 4 open opposite trade and will resulted trade buy in loss and trade sell in profit and exited at the same time.
[email protected] (open a sell trade and set all trade buy S/L == T/P (trade sell) , and clear trade buy T/P=0)
version 5 will resulted trade buy in loss and trade sell in profit and exited at the same time.

For Sideway
[email protected]
this will open both way a trade sell and buy at the same time but have different T/P and will resulted both exited trade at a different time.

That's all. All the best

Attached Image

Attached File
File Type: zip Completed Script 30June2018.zip   441 KB | 1,166 downloads

Attached File
File Type: mq4 [email protected]   8 KB | 903 downloads | Uploaded Aug 8, 2018 9:14am

Attached File
File Type: mq4 [email protected]   8 KB | 917 downloads | Uploaded Aug 8, 2018 9:14am


Extra Indicators - you will know exactly how much profit percentage % in dollar $ and how big is the real percentage lot.
Attached Image

Attached File
File Type: ex4 BuySell-LotINFO-4.ex4   47 KB | 890 downloads


Set Hotkeys for faster trade executions
Attached Image (click to enlarge)
Click to Enlarge

Name: erhwh.PNG
Size: 27 KB


Version 6 Lot% base on balance
Attached File
File Type: zip Script OpenTradev6.zip   118 KB | 848 downloads | Uploaded Nov 5, 2018 2:07pm
  • Post #2
  • Quote
  • Edited Nov 25, 2018 8:17pm Nov 24, 2018 8:36pm | Edited Nov 25, 2018 8:17pm
  •  penyuperwira
  • Joined Aug 2017 | Status: Member | 110 Posts
I've created Expert ButtonTrading on chart for Version 6 Lot% base on balance
Warning : This Expert is still in testing mode.
Please uses XM micro account for testing.
Updated-1 : fixed button Close Buy, Close All and Close Sell !
Updated-2 : fixed with different account contract size... can be uses in standard acc, mini acc and micro acc.
Attached File
File Type: mq4 ButtonTrading.mq4   39 KB | 836 downloads

Attached File
File Type: ex4 ButtonTrading.ex4   41 KB | 731 downloads

Attached Image (click to enlarge)
Click to Enlarge

Name: aesgshj.JPG
Size: 79 KB


Extra Indicator for display info about risk/profit
Updated-1 : fixed with different account contract size... can be uses in standard acc, mini acc and micro acc.
Attached File
File Type: ex4 ButtonTrading_DisplayINFO.ex4   129 KB | 745 downloads

Attached File
File Type: mq4 ButtonTrading_DisplayINFO.mq4   189 KB | 822 downloads

Attached Image (click to enlarge)
Click to Enlarge

Name: rsdhjdj.JPG
Size: 59 KB

Attached Image

Attached Image (click to enlarge)
Click to Enlarge

Name: srehjhdj.JPG
Size: 142 KB
 
2
  • Post #3
  • Quote
  • Nov 25, 2018 2:19am Nov 25, 2018 2:19am
  •  T4Trade
  • Joined Sep 2017 | Status: Trend Following,Price Action,Grid | 1,966 Posts
would you please provide pdf or explain how to use this,these scripts sounds interesting,these works on existing trades or these scripts open the new trades,sorry for my naïve kinda question.
 
 
  • Post #4
  • Quote
  • Nov 25, 2018 2:58am Nov 25, 2018 2:58am
  •  penyuperwira
  • Joined Aug 2017 | Status: Member | 110 Posts
Quoting T4Trade
Disliked
would you please provide pdf or explain how to use this,these scripts sounds interesting.
Ignored
Sorry, I'am so lazy to prepare pdf right now ... to put it in simple way, It just open a trade with a set of TP or SL base on profit percentage...
You can try one by one on demo account, because this script have different style of opening trades...

Quoting T4Trade
Disliked
these works on existing trades or these scripts open the new trades,sorry for my naïve kinda question.
Ignored
Depend on your setting... It can effect T/P and S/L of the existing trades when opening a new trade...
 
1
  • Post #5
  • Quote
  • Edited at 8:18am Nov 25, 2018 7:57am | Edited at 8:18am
  •  penyuperwira
  • Joined Aug 2017 | Status: Member | 110 Posts
I usually trade both ways... with hedge script (it's not actually hedging... it just open trade at both direction at the same time)
If I got stuck with few layer of trades... then the script will calculate where all the trade target T/P should be so that I gain 1% Net Profit...
It only calculate T/P in one direction trade... all the buy trade have the same T/P... and all the sell trade also have the same T/P... buy trade and sell trade never mixed together... When balance is growing, so thus Lots I'am using... this calculate automatically... that is why I got this result
Attached Image (click to enlarge)
Click to Enlarge

Name: sdehfhj.JPG
Size: 265 KB
 
 
  • Post #6
  • Quote
  • Nov 25, 2018 5:47pm Nov 25, 2018 5:47pm
  •  penyuperwira
  • Joined Aug 2017 | Status: Member | 110 Posts
UPDATE : I've been testing on Live Market with EA ButtonTrading. The result is everything working fine except the Close Buy, Close All and Close Sell button, the issues is when pressed Close, nothing really happened. I'll working on that soon...

Result : WithLive XM Micro account... included existing trades.

1. When button Delete TP/SL is pressed (clear existing TP/SL of all trades)
Attached Image (click to enlarge)
Click to Enlarge

Name: sdrhshj.JPG
Size: 176 KB


2. When button Single TP/SL is pressed (modify all existing TP, every trade has it's own TP with 1% profit)
Attached Image (click to enlarge)
Click to Enlarge

Name: rhsxhsh.JPG
Size: 187 KB


3. When button Net % TP/SL is pressed (modify all existing TP with Net 1% profit, every trade have same TP)
Attached Image (click to enlarge)
Click to Enlarge

Name: frhhj.JPG
Size: 179 KB


4. When button Buy is pressed (only open one buy trade with it's own TP, 1% profit, existing TP is not modify)
Attached Image (click to enlarge)
Click to Enlarge

Name: sehdhsfh.JPG
Size: 186 KB


5.When button Hedge is pressed (open a buy trade with Net 1% profit and modify existing TP)
Attached Image (click to enlarge)
Click to Enlarge

Name: esghsh.JPG
Size: 190 KB


6. When button Sell or Sell Net is pressed (only open one sell trade with it's own TP, 1% profit, buy trade is not disturb)
Attached Image (click to enlarge)
Click to Enlarge

Name: drhdj.JPG
Size: 198 KB
 
 
  • Post #7
  • Quote
  • Edited at 6:59pm Nov 25, 2018 6:48pm | Edited at 6:59pm
  •  penyuperwira
  • Joined Aug 2017 | Status: Member | 110 Posts
I've updated files for EA ButtonTrading on post#2.

Quoting penyuperwira
Disliked
Updated : fixed button Close Buy, Close All and Close Sell !
Ignored
I've also confirm, this EA ButtonTrading will not works properly on XM standard account...
So please uses XM micro Live account for testing...
because there is only XM Standard Demo account available.
I'll try to fix it as soon as possible for standard account.
 
 
  • Post #8
  • Quote
  • Nov 25, 2018 8:12pm Nov 25, 2018 8:12pm
  •  penyuperwira
  • Joined Aug 2017 | Status: Member | 110 Posts
I've successfully fixed the problem with different account type (contract size)... already uploaded new file on post#2

Quoting penyuperwira
Disliked
Updated-2 : fixed with different account contract size... can be uses in standard acc, mini acc and micro acc.
Ignored
 
 
  • Post #9
  • Quote
  • Nov 25, 2018 8:31pm Nov 25, 2018 8:31pm
  •  penyuperwira
  • Joined Aug 2017 | Status: Member | 110 Posts
This code "account_type" added to make sure the pips calculation for take profit is correct for Standard, Mini and micro acc.
Inserted Code
//compare different contract size for account type
   if(SymbolInfoDouble(Symbol(), SYMBOL_TRADE_CONTRACT_SIZE)==1000) account_type=10;
   if(SymbolInfoDouble(Symbol(), SYMBOL_TRADE_CONTRACT_SIZE)==10000) account_type=1;
   if(SymbolInfoDouble(Symbol(), SYMBOL_TRADE_CONTRACT_SIZE)==100000) account_type=0.1;
 //calculation for take profit
   double StopPercentage=(Balance+Credit) *(StopPercent/100);
   double StopPipsMath=NormalizeDouble((StopPercentage)/(GetLots()/account_type),0);
   double ProfitPercentage=(AccountBalance()+Credit) *(ProfitPercent/100);
   double ProfitPipsMath=NormalizeDouble((ProfitPercentage)/(GetLots()/account_type),0);
 
 
  • Post #10
  • Quote
  • Nov 25, 2018 8:38pm Nov 25, 2018 8:38pm
  •  tzamo
  • Joined Nov 2017 | Status: Member | 714 Posts
Dear penyuperwira,

Thank you for sharing these nice scripts and EA to speed up execution and auto calculation for a tp target at desired %.

Kind Regards,
Tzamo
"Only you can Make the Future you will be proud to be a part of..." -Me
 
2
  • Post #11
  • Quote
  • Edited at 1:24am Nov 26, 2018 12:46am | Edited at 1:24am
  •  penyuperwira
  • Joined Aug 2017 | Status: Member | 110 Posts
This is slightly upgrade version of EA ButtonTrading from post#2.
It has default enable close only profit trade...
and after that auto modify all T/P for remaining trade with Net % profit
Attached File
File Type: ex4 ButtonTrading.ex4   40 KB | 757 downloads

Attached File
File Type: mq4 ButtonTrading.mq4   40 KB | 825 downloads

Attached Image


Inserted Code
      if(OrderType()==OP_SELL && Symbol()==OrderSymbol() && !CloseProfitOnly)  //condition false
        {
         closed=OrderClose(OrderTicket(),OrderLots(),Ask,Slippage,White); // close all trades
        }                                                                                                              
      else if(OrderType()==OP_SELL && Symbol()==OrderSymbol() && CloseProfitOnly && OrderProfit()>0) //condition true
        {                                                                                              
         closed=OrderClose(OrderTicket(),OrderLots(),Ask,Slippage,White); // close only profit trades
         NetTP();     // modifty all the remaining trades T/P with Net % profit
        }
 
 
  • Post #12
  • Quote
  • Edited at 2:15am Nov 27, 2018 1:51am | Edited at 2:15am
  •  penyuperwira
  • Joined Aug 2017 | Status: Member | 110 Posts
Hi, I've created another Version... name it EA ButtonTradingV2 to gain more control on specific task.
You can arrange Button Horizontal or Vertical...
Attached File
File Type: ex4 ButtonTradingV2.ex4   54 KB | 769 downloads

Attached File
File Type: mq4 ButtonTradingV2.mq4   47 KB | 789 downloads

Attached Image (click to enlarge)
Click to Enlarge

Name: azgahgh.PNG
Size: 11 KB

Attached Image (click to enlarge)
Click to Enlarge

Name: srehgsh.PNG
Size: 42 KB
 
 
  • Post #13
  • Quote
  • Edited at 6:51am Nov 27, 2018 6:35am | Edited at 6:51am
  •  penyuperwira
  • Joined Aug 2017 | Status: Member | 110 Posts
This is the same EA above... but with refine cosmetic looks... named as EA ButtonTradingV2.01
Attached File
File Type: mq4 ButtonTradingV2.01.mq4   46 KB | 820 downloads

Attached File
File Type: ex4 ButtonTradingV2.01.ex4   70 KB | 764 downloads

Attached Image (click to enlarge)
Click to Enlarge

Name: jtt.PNG
Size: 38 KB
 
 
  • Post #14
  • Quote
  • Nov 27, 2018 6:39am Nov 27, 2018 6:39am
  •  Aqwerk
  • | Joined Feb 2018 | Status: Member | 69 Posts
How long have you been using this system for? All I see is a month'srecord.
 
 
  • Post #15
  • Quote
  • Nov 27, 2018 7:05am Nov 27, 2018 7:05am
  •  penyuperwira
  • Joined Aug 2017 | Status: Member | 110 Posts
Quoting Aqwerk
Disliked
How long have you been using this system for? All I see is a month'srecord.
Ignored
I've been using the same day as I posted... using script only since June 2018...
and I just made the ButtonTrading EA since 26 Nov 2018... and been using it since...

The trade explorer is not meant to show my system can create great profit... because I just trade manually.
Profit depend on my analysis and luck to be honest...

The script and button just to help speed up my execution trade and automate calculation involving how much Lots should I take and where the take profit should've been put.
 
 
  • Post #16
  • Quote
  • Nov 27, 2018 7:22am Nov 27, 2018 7:22am
  •  Aqwerk
  • | Joined Feb 2018 | Status: Member | 69 Posts
Quoting penyuperwira
Disliked
{quote} I've been using the same day as I posted... using script only since June 2018... and I just made the ButtonTrading EA since 26 Nov 2018... and been using it since... The trade explorer is not meant to show my system can create great profit... because I just trade manually. Profit depend on my analysis and luck to be honest... The script and button just to help speed up my execution trade and automate calculation involving how much Lots should I take and where the take profit should've been put.
Ignored
I don't believe in luck. But if it's working for you, keep it up.
 
 
  • Post #17
  • Quote
  • Nov 27, 2018 7:54am Nov 27, 2018 7:54am
  •  falanca
  • Joined Sep 2007 | Status: Member | 347 Posts
İs indicator for currency specific or for total orders.İ mixed some
 
 
  • Post #18
  • Quote
  • Edited at 8:49am Nov 27, 2018 8:16am | Edited at 8:49am
  •  penyuperwira
  • Joined Aug 2017 | Status: Member | 110 Posts
Quoting falanca
Disliked
İs indicator for currency specific or for total orders.İ mixed some
Ignored
Indicator should works correctly with major pair and cross currency pairs... but unfortunately, I don't think it will work correctly with metals like Gold and Silver...

I will try to integrate the indicator into the EA ButtonTrading soon...
the code in the indicators is huge, so it will take some times...

I'am not sure if this picture help to explain in detail...
Attached Image
 
 
  • Post #19
  • Quote
  • Nov 27, 2018 9:23am Nov 27, 2018 9:23am
  •  falanca
  • Joined Sep 2007 | Status: Member | 347 Posts
I wanna give you an idea;put an order(buy or sell),if you put buy order and prices go up then take profits with every x pips.But if prices go down then put opposite order with hedge+ incremental lot.İf prices go down let it go to X pips and take profit.But if goes again opposite direction to upside.Then again put buy order after xpips with hedge+ increment lot.By the way on the chart we must arrange the profit trailing also.
 
 
  • Post #20
  • Quote
  • Nov 27, 2018 9:43am Nov 27, 2018 9:43am
  •  penyuperwira
  • Joined Aug 2017 | Status: Member | 110 Posts
Quoting falanca
Disliked
I wanna give you an idea;put an order(buy or sell),if you put buy order and prices go up then take profits with every x pips.But if prices go down then put opposite order with hedge+ incremental lot.İf prices go down let it go to X pips and take profit.But if goes again opposite direction to upside.Then again put buy order after xpips with hedge+ increment lot.By the way on the chart we must arrange the profit trailing also.
Ignored
I've tried hedging before... it just harder to get out once you end up double your opposite trade lot... it works like charms in sideways market but unfortunately your account will margin call when trending goes extreme sometimes... I found, the best way for me is to never open too many trades at the same price and just uses smaller lots... I don't really like holding profit trades too long... I'am just happy with 1% profit... no trailing for me
 
 
  • Platform Tech
  • /
  • Useful Script for Open Order with Percentage Profit and Lots
  • Reply to Thread
    • Page 1 234 5
    • Page 1 234 5
0 traders viewing now
  • More
Top of Page
  • Facebook
  • Twitter
About CC
  • Mission
  • Products
  • User Guide
  • Blog
  • Contact
CC Products
  • Forums
  • Calendar
  • News
  • Coins
  • Market
CC Website
  • Homepage
  • Search
  • Members
  • Report a Bug
Follow CC
  • Facebook
  • Twitter

CC Sister Sites:

  • Metals Mine
  • Energy EXCH
  • Forex Factory

Crypto Craft® is a brand of Fair Economy, Inc.

Terms of Service / ©2022