Gamestudio Links
Zorro Links
Newest Posts
folder management functions
by 7th_zorro. 04/16/24 13:19
lookback setting performance issue
by 7th_zorro. 04/16/24 03:08
zorro 64bit command line support
by 7th_zorro. 04/15/24 09:36
Zorro FIX plugin - Experimental
by flink. 04/14/24 07:48
Zorro FIX plugin - Experimental
by flink. 04/14/24 07:46
LPDIRECT3DCUBETEXTUR
E9

by Ayumi. 04/12/24 11:00
Sam Foster Sound | Experienced Game Composer for Hire
by titanicpiano14. 04/11/24 14:56
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
4 registered members (Ayumi, Quad, rki, 7th_zorro), 482 guests, and 3 spiders.
Key: Admin, Global Mod, Mod
Newest Members
11honza11, ccorrea, sakolin, rajesh7827, juergen_wue
19045 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
lock profit without trail #477605
07/14/19 15:53
07/14/19 15:53
Joined: May 2015
Posts: 390
Czech Republic
G
Grat Offline OP
Senior Member
Grat  Offline OP
Senior Member
G

Joined: May 2015
Posts: 390
Czech Republic
Hi,

I dont like trail function. With this TMF function you can lock profit without laugh

Code
//--------------------- TMF --------------------------------------------------------
#define VAR_LOCK TradeVar[0]
#define VAR_ACTI TradeVar[1]
#define VAR_CLOSE TradeVar[2]

int myTMF(){
  if (TradeIsEntry){
    // only one each trade?
    VAR_LOCK=-1;  // No lock
    VAR_ACTI=1*TradeLots;          // 1 USD/per LOTS ... MT4 1=0.01
    VAR_CLOSE=VAR_ACTI*0.8;        // after profit is target, profit under 80% close trade
  }
  
  if(TradeIsOpen){
    if (TradeProfit > VAR_ACTI)
      VAR_LOCK=1.0; // activate trigger

    if (VAR_LOCK > 0 )
    if (TradeProfit < VAR_CLOSE){
      exitTrade(ThisTrade);
      return 16;
    }

    if (TradeProfit > VAR_ACTI*1.05){
      // Profit > ACTI+5%
      VAR_ACTI=TradeProfit;
      VAR_CLOSE=VAR_ACTI*0.8;
    }
  }    
  
  return 0;
}

Last edited by Grat; 07/14/19 15:54.
Re: lock profit without trail [Re: Grat] #481428
09/15/20 06:05
09/15/20 06:05
Joined: Mar 2019
Posts: 357
D
danatrader Offline
Senior Member
danatrader  Offline
Senior Member
D

Joined: Mar 2019
Posts: 357
Nice, I will make use of it (potentially) laugh

Re: lock profit without trail [Re: Grat] #481437
09/16/20 08:05
09/16/20 08:05
Joined: May 2015
Posts: 390
Czech Republic
G
Grat Offline OP
Senior Member
Grat  Offline OP
Senior Member
G

Joined: May 2015
Posts: 390
Czech Republic
Yes,

in the original is a bug:

int myTMF(){
if (VAR_LOCK == 0){

Re: lock profit without trail [Re: Grat] #481446
09/17/20 21:05
09/17/20 21:05
Joined: Mar 2019
Posts: 357
D
danatrader Offline
Senior Member
danatrader  Offline
Senior Member
D

Joined: Mar 2019
Posts: 357
This is not Grat, this is Great laugh

Re: lock profit without trail [Re: Grat] #481469
09/18/20 13:27
09/18/20 13:27
Joined: Mar 2019
Posts: 357
D
danatrader Offline
Senior Member
danatrader  Offline
Senior Member
D

Joined: Mar 2019
Posts: 357
Is it needed in case of MaxLong = MaxShort > 1 to have a for(current_trades) loop in a TMF or does TMF automatically go through all open trades?

Re: lock profit without trail [Re: Grat] #481471
09/18/20 14:30
09/18/20 14:30
Joined: May 2015
Posts: 390
Czech Republic
G
Grat Offline OP
Senior Member
Grat  Offline OP
Senior Member
G

Joined: May 2015
Posts: 390
Czech Republic
TRADE* EnterTrade(int side)
{
if (side == _LONG)
return enterLong(myTMF);
else
return enterShort(myTMF);
}

Re: lock profit without trail [Re: Grat] #481517
09/24/20 09:59
09/24/20 09:59
Joined: Oct 2017
Posts: 56
Munich
K
kalmar Offline
Junior Member
kalmar  Offline
Junior Member
K

Joined: Oct 2017
Posts: 56
Munich
Thank you, Grat laugh And what is the problem with trails? Thx

Re: lock profit without trail [Re: Grat] #481528
09/25/20 06:46
09/25/20 06:46
Joined: Mar 2019
Posts: 357
D
danatrader Offline
Senior Member
danatrader  Offline
Senior Member
D

Joined: Mar 2019
Posts: 357
Trails in many times reduce profit.


Moderated by  Petra 

Powered by UBB.threads™ PHP Forum Software 7.7.1