Hi,

I have this script:
Code
#include <profile.c>

// -------------------- TRADE MANAGE ------------------------

int myTMF(){

    if(TradeIsOpen){

        printf("\nProfit: %f Limit: %f Prof: %f",TradeProfit,TradeStopLimit,TradeProfitLimit);
    }
    return 0;
}


// --------------------------- Main-----------------------------
function run() {
    
    PlotScale = 8;
    PlotWidth = 1600;
    PlotHeight1 = 600;
    PlotHeight2 = 120;
    set(PLOTNOW+LOGFILE);
    setf(PlotMode,PL_ALL+PL_FINE);
    set(STEPWISE);
    StartDate 	= 20200401;
    BarPeriod = 1;	// 15 min
    LookBack = 100;
    asset("EUR/JPY");
    Stop        = 4*ATRS(40);
    TakeProfit  = 20*ATRS(76);

    // this trade go profit
    if ( hour() == 6 && minute() == 1) enterShort(myTMF);

}


with the asset "EUR/USD" may be work OK. But with "EUR/JPY" I get this output after I open order:

Quote

[EUR/JPY::S29433] Short 1@118.76 Risk 1 p at 06:01:00
Profit: -0.114628 Limit: 251499898170805.870000 Prof: 0.000000

[3295: Wed 20-04-01 06:02] 0000 -0.11 0/1 (118.76)
Profit: -0.026721 Limit: 251499898170805.870000 Prof: 0.000000
[3296: Wed 20-04-01 06:03] 0000 -0.0267 0/1 (118.75)


TradeStopLimit have value 251499898170805.870000

source is in att.

what is correct value in TradeStopLimit?
why is TradeProfitLimit value 0?

from manual:
Quote

Profit limit, initially calculated from TakeProfit; only valid when the trade is open. The trade will be closed when the price reaches this value. Can be modified by the TMF by setting it to the desired price (not to a distance!).

Quote
Current stop level, initially determined from Stop, and modified by trailing. Only valid when the trade is open. The trade will be closed when the price reaches this value. Can be modified by the TMF by setting it to the desired price (not to a distance!).


edit:
is my mistake:
this work:
printf("\nProfit: %f Limit: %f Prof: %f",TradeProfit,(var)TradeStopLimit,(var)TradeProfitLimit);

Attached Files
testTMF.c (46 downloads)
Last edited by Grat; 10/07/20 12:34.