Ti stai perdendo delle opportunità di trading:
- App di trading gratuite
- Oltre 8.000 segnali per il copy trading
- Notizie economiche per esplorare i mercati finanziari
Registrazione
Accedi
Accetti la politica del sito e le condizioni d’uso
Se non hai un account, registrati
Spero che ci sia un valore assegnato alla variabile Percent in OnInit()?
La mia variabile Percent è definita dall'utente. OnInit() l'ho abbandonato.
se Lots=0, niente sarà aperto dal tester
Margin_Percent=AccountFreeMargin()*Percent/100;
Lots=Margin_Percent/MarketInfo(Symbol(),MODE_MARGINREQUIRED);
Lots_Volume=(MathFloor(Lots)+MarketInfo(Symbol(),MODE_LOTSTEP));
if(Lots>Lots_Volume){
Lots=Lots_Volume;
}
else if(Lots<Lots_Volume)
Lots=MathFloor(Lots);
Print("Количество лотов : ",Lots);
return;
E ancora, dove nel codice è impostato Percent
e cosa fa il seguente comando print("Lots : ",Lots); ?
Tuttavia, dove si trova nel codice Percent
e cosa fa il seguente comando print("Number of lots : ",Lots); ?
#property version "1.00"
#property strict
//--- input parameters
input int Percent=50;
input int Fast_EMA_Period=12;
input int Slow_EMA_Period=25;
input int Signal_Period=9;
input double Step_PSAR=0.02;
input double Maximum_PSAR=0.2;
input int MAGICNUMBER=413;
static datetime New_Time;// Время текущего бара
double Margin_Percent; //Используемые средства для открытия ордеров
double Lots;//Определение общего количества лотов
double Lots_Volume;
double MacdCurrent;//Параметры MACD основной линии текущего бара
double MacdPrevious1;//Параметры MACD основной линии предыдущего бара
double MacdPrevious2;//Параметры MACD основной линии со смещением на 2 бара
double StopLoss;//Параметры Трейлинг стоп по параметрам ParabolicSAR текущего бара
double Previous_StopLoss;//Параметры СтопЛосс по параметрам ParabolicSAR предыдущего бара
double CurrentPSAR;//Параметры СтопЛосс по параметрам ParabolicSAR предыдущего бара
//+------------------------------------------------------------------+
//| Expert tick function |
//+------------------------------------------------------------------+
void OnTick()
{
bool New_Bar=false; // Флаг нового бара
int ticket,total,cnt;
//---------------------------------------------------------------------------
New_Time=TimeCurrent();
if(Time[0]==New_Time) // Сравниваем время
New_Bar=true; // Поймался новый бар
else if(New_Bar==false) // Если бар не новый..
Nella quinta linea Percent è impostato. Il registro mostra: "Il numero di lotti è 90.0100000001". Forse dovremmo aggiungere NormalizeDouble()?
Non c'è niente di sbagliato nel lotto.
Cerca un errore nella logica di apertura dell'ordine.
In questi casi, di solito imposto una condizione esplicita che aprirà l'ordine
Non c'è niente di sbagliato nel lotto.
Cerca un errore nella logica di apertura dell'ordine.
Di solito in questi casi imposto una condizione esplicita che l'ordine si apra
Per favore, fate un esempio con una condizione esplicita. Se ho capito bene, ci dovrebbe essere una condizione nel ciclo per l'apertura. Giusto?
Date un comando per aprire un ordine all'inizio del codice, subito dopo aver calcolato il lotto, e assicuratevi che il tester funzioni correttamente. Poi si può rimettere tutto a posto.
La quinta riga specifica Percent. Il registro visualizza: "Numero di lotti 90.0100000001". Forse dovremmo aggiungere NormalizeDouble()?